<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns="http://purl.org/rss/1.0/"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/">

  <channel rdf:about="http://xor.zoku-sei.com/RSS/100/">
    <title>XOR</title>
    <link>http://xor.zoku-sei.com/</link>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://xor.zoku-sei.com/RSS/" />
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" />
    <description>天邪鬼のそこはかとない日記</description>
    <dc:language>ja</dc:language>
    <dc:date>2024-12-17T08:06:17+09:00</dc:date>
    <items>
    <rdf:Seq>
      <rdf:li rdf:resource="http://xor.zoku-sei.com/Entry/4/" />
      <rdf:li rdf:resource="http://xor.zoku-sei.com/Entry/87/" />
      <rdf:li rdf:resource="http://xor.zoku-sei.com/Entry/86/" />
      <rdf:li rdf:resource="http://xor.zoku-sei.com/Entry/85/" />
      <rdf:li rdf:resource="http://xor.zoku-sei.com/Entry/84/" />
      <rdf:li rdf:resource="http://xor.zoku-sei.com/Entry/83/" />
      <rdf:li rdf:resource="http://xor.zoku-sei.com/Entry/82/" />
      <rdf:li rdf:resource="http://xor.zoku-sei.com/Entry/81/" />
      <rdf:li rdf:resource="http://xor.zoku-sei.com/Entry/79/" />
      <rdf:li rdf:resource="http://xor.zoku-sei.com/Entry/78/" />
    </rdf:Seq>
    </items>
  </channel>

  <item rdf:about="http://xor.zoku-sei.com/Entry/4/">
    <link>http://xor.zoku-sei.com/Entry/4/</link>
    <title>XORとは</title>
    <description>えっ、そこ？みたいな観点でつづっていきたいと思わなくもないこともない
nwpfhがお送りするブログです。ちなみにXORで検索に引っかかってしまうので説明を軽く...</description>
    <content:encoded><![CDATA[えっ、そこ？みたいな観点でつづっていきたいと思わなくもないこともない<br />
nwpfhがお送りするブログです。<br /><br /><a href="http://xor.zoku-sei.com/Entry/4/" target="_blank">ちなみにXORで検索に引っかかってしまうので説明を軽く</a>]]></content:encoded>
    <dc:subject>linux</dc:subject>
    <dc:date>2030-12-31T23:59:59+09:00</dc:date>
    <dc:creator>nwpfh</dc:creator>
    <dc:publisher>NINJA BLOG</dc:publisher>
    <dc:rights>nwpfh</dc:rights>
  </item>
  <item rdf:about="http://xor.zoku-sei.com/Entry/87/">
    <link>http://xor.zoku-sei.com/Entry/87/</link>
    <title>fluxboxからlabwcへの切り替え時にfluxboxでgnome-terminalから入力できなくなる</title>
    <description>fluxboxからlabwcに切り替えてみた下記インストールする必要があり
 
  sudo add-apt-repository ppa:samoilov-lex/labwc
  sudo apt-get install labwc
  sudo apt-get install waybar
  ...</description>
    <content:encoded><![CDATA[fluxboxからlabwcに切り替えてみた下記インストールする必要があり
<pre> 
  sudo add-apt-repository ppa:samoilov-lex/labwc
  sudo apt-get install labwc
  sudo apt-get install waybar
  sudo apt-get install swaylock
  sudo apt-get install fonts-font-awesome
  sudo apt-get install fonts-fork-awesome
  sudo apt-get install fcitx5
  sudo apt-get install wl-clipboard
  sudo apt install fcitx5-mozc
  sudo apt-get isntall dmenu
</pre>
<br />
labwcに切り替えたが、fluxboxからgnome-terminalから入力できなくなる。。。<br />
原因はwaylandが含まれるbus情報があるとx11で行っていた入力ができなくなるらしい・・・
<pre>(例)
~/.config/ibus/bus/49ba92f181ac4a7caf727f7c56429585-unix-wayland-0 
</pre>]]></content:encoded>
    <dc:subject>linux</dc:subject>
    <dc:date>2024-08-17T18:44:23+09:00</dc:date>
    <dc:creator>nwpfh</dc:creator>
    <dc:publisher>NINJA BLOG</dc:publisher>
    <dc:rights>nwpfh</dc:rights>
  </item>
  <item rdf:about="http://xor.zoku-sei.com/Entry/86/">
    <link>http://xor.zoku-sei.com/Entry/86/</link>
    <title>[Solved] OEM unlock greyed out</title>
    <description>I installed lineageOS for pixel 6a. But I couldn&#039;t unlock my phone. &amp;quot;fastboot flashing unlock&amp;quot; didn&#039;t work. Because get_unlock_ability is 0. I looked ...</description>
    <content:encoded><![CDATA[I installed lineageOS for pixel 6a. But I couldn't unlock my phone. "fastboot flashing unlock" didn't work. Because get_unlock_ability is 0. I looked up for <a href="https://source.android.com/docs/core/architecture/bootloader/locking_unlocking" title="" target="_blank">this page</a>. I couldn't become root, So I clouldn't change ro.oem_unlock_supported option. So I turn on development mode, And displayed developer options. I understood oem lock is disabled. so I search oem unlock, But oem unlock greyed out. I finally found out. I did checkin on <a href="https://source.android.com/docs/setup/build/flash#preparing-your-device" title="" target="_blank">this page</a>. All worked.]]></content:encoded>
    <dc:subject>android</dc:subject>
    <dc:date>2024-01-13T21:58:18+09:00</dc:date>
    <dc:creator>nwpfh</dc:creator>
    <dc:publisher>NINJA BLOG</dc:publisher>
    <dc:rights>nwpfh</dc:rights>
  </item>
  <item rdf:about="http://xor.zoku-sei.com/Entry/85/">
    <link>http://xor.zoku-sei.com/Entry/85/</link>
    <title>PythonでExcelをTSVに変換してみた</title>
    <description>pythonでExcelからTSVに変換してみた。
DataFrameでもできるのだけども、ストリーム系でないとメモリをめっちゃ食ってしまう。
ソース

37万件のデータで実施した場合、
■今回のソースの場合

$ time python excel2tsv_e.py KEN_ALL.xlsx &amp;amp;g...</description>
    <content:encoded><![CDATA[pythonでExcelからTSVに変換してみた。<br />
DataFrameでもできるのだけども、ストリーム系でないとメモリをめっちゃ食ってしまう。<br />
<a href="https://gist.github.com/doshiraki/3f23cf44d41d50b2b60d9b966244360e">ソース</a><br />
<br />
37万件のデータで実施した場合、<br />
■今回のソースの場合<br />

<pre>$ time python excel2tsv_e.py KEN_ALL.xlsx &gt; ken_all2.txt 

real    0m38.720s
user    0m38.614s
sys     0m0.105s
</pre>
<br />
■DataFrameを使った場合<br />

<pre>$ time python excel2tsv_p.py KEN_ALL.xlsx

real    0m47.467s
user    0m47.094s
sys     0m1.139s
</pre>
<br />
lxml速い。<br />
startイベントでendイベントの関数を生成するの結構良いかも。<br />
あと、4階層以下は都度都度メモリ解放しなくしてるのもうまく働いている。<br />
DataFrameだと最大800Mまでメモリを使用するが、今回のだと50Mくらい。
<pre>            for event, elem in parser.read_events():
                if event == "end":
                    yield event, elem, stack
                    stack.pop()
                    if 1 &lt;= len(stack) &lt;= 2:
                        stack[-1].remove(elem)
                    level -= 1
                else:
                    level += 1
                    stack.append(elem)
                    yield event, elem, stack
</pre>]]></content:encoded>
    <dc:subject>Python</dc:subject>
    <dc:date>2023-02-19T10:57:02+09:00</dc:date>
    <dc:creator>nwpfh</dc:creator>
    <dc:publisher>NINJA BLOG</dc:publisher>
    <dc:rights>nwpfh</dc:rights>
  </item>
  <item rdf:about="http://xor.zoku-sei.com/Entry/84/">
    <link>http://xor.zoku-sei.com/Entry/84/</link>
    <title>mkfifoを使わずに、プログラムの循環パイプ(yourPG | interpreter | yourPG)サンドウィッチ</title>
    <description>mkfifoを使うと、重複して使えないので、名前なしパイプに名前を付けてみた。

ソース

■使い方 fifoの使い道と同じことがパイプファイルなしにできる。

$ ./a.out
$ $PIPEIN | bash | tee /dev/stderr | python ./test.py | tee...</description>
    <content:encoded><![CDATA[mkfifoを使うと、重複して使えないので、名前なしパイプに名前を付けてみた。<br />
<br />
<a href="https://gist.github.com/doshiraki/779dd679c9d05f3119250655bda70a7f" title="" target="_blank">ソース</a><br />
<br />
■使い方 <a href="https://xor.zoku-sei.com/Entry/82/" title="" target="_blank">fifoの使い道</a>と同じことがパイプファイルなしにできる。<br />

<pre>$ ./a.out
$ $PIPEIN | bash | tee /dev/stderr | python ./test.py | tee /dev/stderr | $PIPEOUT
</pre>
<br />
プロセス内で作成したパイプ処理を環境変数に閉じ込めて、bash呼び出しは重複して呼び出せるので良いかも。]]></content:encoded>
    <dc:subject>C/C++</dc:subject>
    <dc:date>2022-08-15T18:59:08+09:00</dc:date>
    <dc:creator>nwpfh</dc:creator>
    <dc:publisher>NINJA BLOG</dc:publisher>
    <dc:rights>nwpfh</dc:rights>
  </item>
  <item rdf:about="http://xor.zoku-sei.com/Entry/83/">
    <link>http://xor.zoku-sei.com/Entry/83/</link>
    <title>MovableType To Yaml のsedスクリプト作ってみた。</title>
    <description>引越し検討がてら、MovableType To Yaml のsedスクリプト作ってみた。
MovableTypeフォーマット
このフォーマットsedで置換できますか？

ソース

いい感じにyamlになって使い勝手が良いかも？
 
 
 

Qiitaはエクスポート標準で対応してないし、インポートも...</description>
    <content:encoded><![CDATA[引越し検討がてら、MovableType To Yaml のsedスクリプト作ってみた。<br />
<a href="https://www.movabletype.jp/documentation/mt7/appendices/export-import-format/" title="" target="_blank">MovableTypeフォーマット</a><br />
このフォーマットsedで置換できますか？<br />
<br />
<a href="https://gist.github.com/doshiraki/c28d1d349341b4d205f4324140c24f17" title="" target="_blank">ソース</a><br />
<br />
いい感じにyamlになって使い勝手が良いかも？<br />
<a href="//xor.zoku-sei.com/File/unknown.png" title="" target="_blank"><img src="//xor.zoku-sei.com/File/unknown.png" width="100%" alt="" /> <br />
</a> <br />
<a href="//xor.zoku-sei.com/File/b312ae2e.png" title="" target="_blank"><img src="//xor.zoku-sei.com/File/b312ae2e.png" width="100%" alt="" /> </a><br />
<br />
Qiitaはエクスポート標準で対応してないし、インポートもできないのか。。。<br />
引越し辞めるかw]]></content:encoded>
    <dc:subject>sed</dc:subject>
    <dc:date>2022-08-15T18:48:58+09:00</dc:date>
    <dc:creator>nwpfh</dc:creator>
    <dc:publisher>NINJA BLOG</dc:publisher>
    <dc:rights>nwpfh</dc:rights>
  </item>
  <item rdf:about="http://xor.zoku-sei.com/Entry/82/">
    <link>http://xor.zoku-sei.com/Entry/82/</link>
    <title>mkfifoの使い道</title>
    <description>mkfifoを使うと標準出力と標準入力を用いてインタプリタのプログラムを組むことが容易になる。

pythonプログラム(subprocessを用いていない)

import re
def send(s):
    RET = &amp;quot;@@RETURN VALUE@@&amp;quot;
    print(s+&amp;quot;;ech...</description>
    <content:encoded><![CDATA[mkfifoを使うと標準出力と標準入力を用いてインタプリタのプログラムを組むことが容易になる。<br />
<br />
pythonプログラム(subprocessを用いていない)<br />

<pre>import re
def send(s):
    RET = "@@RETURN VALUE@@"
    print(s+";echo {} $?".format(RET))
    outputs = []
    while True:
        output = input()
        if re.search("^{} ".format(RET), output):
            m = re.match("^{} (.*)".format(RET), output)
            return (int(m.groups()[0]), outputs)
        outputs.append(output)

import sys
print(send("ping www.google.co.jp -c 4"), file=sys.stderr)
print(send("ls ----"), file=sys.stderr)
</pre>
subprocessなしでシェルをキック<br />

<pre>$ mkfifo net
$ bash &lt; net 2&gt;&amp;1 | tee /dev/stderr | python ls.py | tee net
ping www.google.co.jp -c 4;echo @@RETURN VALUE@@ $?
PING www.google.co.jp (142.250.206.195) 56(84) bytes of data.
64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=1 ttl=56 time=14.8 ms
64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=2 ttl=56 time=16.6 ms
64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=3 ttl=56 time=15.8 ms
64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=4 ttl=56 time=15.4 ms

--- www.google.co.jp ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 14.760/15.666/16.645/0.681 ms
@@RETURN VALUE@@ 0
(0, ['PING www.google.co.jp (142.250.206.195) 56(84) bytes of data.', '64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=1 ttl=56 time=14.8 ms', '64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=2 ttl=56 time=16.6 ms', '64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=3 ttl=56 time=15.8 ms', '64 bytes from kix07s07-in-f3.1e100.net (142.250.206.195): icmp_seq=4 ttl=56 time=15.4 ms', '', '--- www.google.co.jp ping statistics ---', '4 packets transmitted, 4 received, 0% packet loss, time 3005ms', 'rtt min/avg/max/mdev = 14.760/15.666/16.645/0.681 ms'])
ls ----;echo @@RETURN VALUE@@ $?
ls: unrecognized option '----'
Try 'ls --help' for more information.
@@RETURN VALUE@@ 2
(2, ["ls: unrecognized option '----'", "Try 'ls --help' for more information."])
</pre>
<br />
ほかにも、通信系のインタプリタをライブラリなしで実行することができる。<br />
便利なり。<br />
その代わり、標準出力は使えないが(笑)簡易RPA的なコンソールプログラムはすぐに作れる。]]></content:encoded>
    <dc:subject>linux</dc:subject>
    <dc:date>2022-08-14T07:38:52+09:00</dc:date>
    <dc:creator>nwpfh</dc:creator>
    <dc:publisher>NINJA BLOG</dc:publisher>
    <dc:rights>nwpfh</dc:rights>
  </item>
  <item rdf:about="http://xor.zoku-sei.com/Entry/81/">
    <link>http://xor.zoku-sei.com/Entry/81/</link>
    <title>Ubuntuの復旧 Ubuntu18.04→Ubuntu20.04へのアップデート</title>
    <description>・Ubuntuが起動できなくなったので、インストールCDでリカバリした。
マウント
chroot

デバイスドライバまわりのメモ
・r8168ネットワークドライバが認識しない。
　RTL8111/8168/8411 のインストールに苦悩した話
・i915ビデオドライバがflickerする。
　「PC...</description>
    <content:encoded><![CDATA[・Ubuntuが起動できなくなったので、インストールCDでリカバリした。<br />
<a href="https://www.linuxfromscratch.org/lfs/view/stable/chapter07/kernfs.html" title="" target="_blank">マウント</a><br />
<a href="https://www.linuxfromscratch.org/lfs/view/stable/chapter07/chroot.html" title="" target="_blank">chroot</a><br />
<br />
デバイスドライバまわりのメモ<br />
・r8168ネットワークドライバが認識しない。<br />
　<a href="https://tarufu.info/r8168-ubuntu/" title="" target="_blank">RTL8111/8168/8411 のインストールに苦悩した話</a><br />
・i915ビデオドライバがflickerする。<br />
　<a href="https://l-w-i.net/t/ubuntu/pci_bus_error_100.txt" title="" target="_blank">「PCIe Bus Error: severity=Corrected, type=Data Link Layer」を回避する方法</a>]]></content:encoded>
    <dc:subject>未選択</dc:subject>
    <dc:date>2021-11-28T09:08:07+09:00</dc:date>
    <dc:creator>nwpfh</dc:creator>
    <dc:publisher>NINJA BLOG</dc:publisher>
    <dc:rights>nwpfh</dc:rights>
  </item>
  <item rdf:about="http://xor.zoku-sei.com/Entry/79/">
    <link>http://xor.zoku-sei.com/Entry/79/</link>
    <title>AGC039 Graph partitionを解いてみた</title>
    <description>AGC039に参加して問題Bが解けなかったのだけども、解き方が分かったので解説

問題としては、同じVnに辺があってはいけないというもの。
 
幅優先探索法で、既に探索済みのノードに出会った場合、次のレベルか前のレベルかしかないということに気づけば後はもっとも長いパスを見つければOK
 

うーん、...</description>
    <content:encoded><![CDATA[AGC039に参加して<a href="https://atcoder.jp/contests/agc039/tasks/agc039_b" title="" target="_blank">問題B</a>が解けなかったのだけども、解き方が分かったので解説<br />
<br />
問題としては、同じVnに辺があってはいけないというもの。<br />
<a target="_blank" href="//xor.zoku-sei.com/File/AGC039B1.png" title=""><img src="//xor.zoku-sei.com/Img/1570360277/" alt="" width="80%" /></a> <br />
幅優先探索法で、既に探索済みのノードに出会った場合、次のレベルか前のレベルかしかないということに気づけば後はもっとも長いパスを見つければOK<br />
<a target="_blank" href="//xor.zoku-sei.com/File/AGC039B2.png" title=""><img src="//xor.zoku-sei.com/Img/1570360276/" alt="" width="80%" /></a> <br />
<br />
うーん、時間中には思いつかん。。。]]></content:encoded>
    <dc:subject>atcoder</dc:subject>
    <dc:date>2019-10-06T20:17:58+09:00</dc:date>
    <dc:creator>nwpfh</dc:creator>
    <dc:publisher>NINJA BLOG</dc:publisher>
    <dc:rights>nwpfh</dc:rights>
  </item>
  <item rdf:about="http://xor.zoku-sei.com/Entry/78/">
    <link>http://xor.zoku-sei.com/Entry/78/</link>
    <title>赤黒木をgoで実装してみた</title>
    <description>作ったのはこちら
https://github.com/doshiraki/rbtree_bygo/blob/master/rbtree.go


赤黒木

やっぱり削除は難しい。。。
ポイントは、delete case 3,4がまったく同じ結果というようにまとめられること。

	Node := d...</description>
    <content:encoded><![CDATA[作ったのはこちら<br />
<a href="https://github.com/doshiraki/rbtree_bygo/blob/master/rbtree.go" title="" target="_blank">https://github.com/doshiraki/rbtree_bygo/blob/master/rbtree.go</a><br />
<br />
<br />
<a href="https://en.wikipedia.org/wiki/Red%E2%80%93black_tree" title="" target="_blank">赤黒木</a><br />
<br />
やっぱり削除は難しい。。。<br />
ポイントは、delete case 3,4がまったく同じ結果というようにまとめられること。<br />

<pre>	Node := delNode
	for {
		parent := Node.parent
		if parent == nil {
			<strong><span style="text-decoration: underline;">//case 1</span></strong>
			break
		}

		dir := Node.dir()
		dirOther := dir ^ 1
		sibling := parent.children[dirOther]

		if sibling.isRed {
			<strong><span style="text-decoration: underline;">//case 2</span></strong>
			parent.flip(dirOther)
			sibling.isRed = false
			parent.isRed = true
			sibling = parent.children[dirOther]
		}
		<span style="text-decoration: underline;">//sibling is Black</span>

		nephew := sibling.children[dirOther]
		if nephew == nil || !nephew.isRed {
			<span style="text-decoration: underline;">//far nephew is Black</span>
			nephew = sibling.children[dir]
			if nephew == nil || !nephew.isRed {
				<span style="text-decoration: underline;">//near nephew is Black</span>
				sibling.isRed = true
				if parent.isRed {
					<strong><span style="text-decoration: underline;">//case 4</span></strong>
					parent.isRed = false
					break
				} else {
					<strong><span style="text-decoration: underline;">//case 3</span></strong>
					Node = parent
					continue
				}
			}
			<strong><span style="text-decoration: underline;">//case 5</span></strong>
			<span style="text-decoration: underline;">//near nephew is Red and far nephew is Black</span>
			sibling.flip(dir)
			sibling, nephew = nephew, sibling
			sibling.isRed = false
			nephew.isRed = true
		}
		<strong><span style="text-decoration: underline;">//case 6</span></strong>
		<span style="text-decoration: underline;">//sibling is Black &amp;&amp; far nephew is Red</span>

		saveColor := parent.isRed
		parent.flip(dirOther)
		sibling.isRed = saveColor
		parent.isRed = false
		nephew.isRed = false
		break

	}

</pre>]]></content:encoded>
    <dc:subject>go</dc:subject>
    <dc:date>2019-09-23T10:24:22+09:00</dc:date>
    <dc:creator>nwpfh</dc:creator>
    <dc:publisher>NINJA BLOG</dc:publisher>
    <dc:rights>nwpfh</dc:rights>
  </item>
</rdf:RDF>
