<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" >
  <channel>
  <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/" />
  <description>天邪鬼のそこはかとない日記</description>
  <lastBuildDate>Mon, 16 Dec 2024 23:06:17 GMT</lastBuildDate>
  <language>ja</language>
  <copyright>© Ninja Tools Inc.</copyright>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" />

    <item>
    <title>XORとは</title>
    <description>
    <![CDATA[えっ、そこ？みたいな観点でつづっていきたいと思わなくもないこともない<br />
nwpfhがお送りするブログです。<br /><br /><a href="http://xor.zoku-sei.com/Entry/4/" target="_blank">ちなみにXORで検索に引っかかってしまうので説明を軽く</a>]]>
    </description>
    <category>linux</category>
    <link>http://xor.zoku-sei.com/Entry/4/</link>
    <pubDate>Tue, 31 Dec 2030 14:59:59 GMT</pubDate>
    <guid isPermaLink="false">xor.zoku-sei.com://entry/4</guid>
  </item>
    <item>
    <title>fluxboxからlabwcへの切り替え時にfluxboxでgnome-terminalから入力できなくなる</title>
    <description>
    <![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>]]>
    </description>
    <category>linux</category>
    <link>http://xor.zoku-sei.com/Entry/87/</link>
    <pubDate>Sat, 17 Aug 2024 09:44:23 GMT</pubDate>
    <guid isPermaLink="false">xor.zoku-sei.com://entry/87</guid>
  </item>
    <item>
    <title>[Solved] OEM unlock greyed out</title>
    <description>
    <![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.]]>
    </description>
    <category>android</category>
    <link>http://xor.zoku-sei.com/Entry/86/</link>
    <pubDate>Sat, 13 Jan 2024 12:58:18 GMT</pubDate>
    <guid isPermaLink="false">xor.zoku-sei.com://entry/86</guid>
  </item>
    <item>
    <title>PythonでExcelをTSVに変換してみた</title>
    <description>
    <![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>]]>
    </description>
    <category>Python</category>
    <link>http://xor.zoku-sei.com/Entry/85/</link>
    <pubDate>Sun, 19 Feb 2023 01:57:02 GMT</pubDate>
    <guid isPermaLink="false">xor.zoku-sei.com://entry/85</guid>
  </item>
    <item>
    <title>mkfifoを使わずに、プログラムの循環パイプ(yourPG | interpreter | yourPG)サンドウィッチ</title>
    <description>
    <![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呼び出しは重複して呼び出せるので良いかも。]]>
    </description>
    <category>C/C++</category>
    <link>http://xor.zoku-sei.com/Entry/84/</link>
    <pubDate>Mon, 15 Aug 2022 09:59:08 GMT</pubDate>
    <guid isPermaLink="false">xor.zoku-sei.com://entry/84</guid>
  </item>
    <item>
    <title>MovableType To Yaml のsedスクリプト作ってみた。</title>
    <description>
    <![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]]>
    </description>
    <category>sed</category>
    <link>http://xor.zoku-sei.com/Entry/83/</link>
    <pubDate>Mon, 15 Aug 2022 09:48:58 GMT</pubDate>
    <guid isPermaLink="false">xor.zoku-sei.com://entry/83</guid>
  </item>
    <item>
    <title>mkfifoの使い道</title>
    <description>
    <![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的なコンソールプログラムはすぐに作れる。]]>
    </description>
    <category>linux</category>
    <link>http://xor.zoku-sei.com/Entry/82/</link>
    <pubDate>Sat, 13 Aug 2022 22:38:52 GMT</pubDate>
    <guid isPermaLink="false">xor.zoku-sei.com://entry/82</guid>
  </item>
    <item>
    <title>Ubuntuの復旧 Ubuntu18.04→Ubuntu20.04へのアップデート</title>
    <description>
    <![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>]]>
    </description>
    <category>未選択</category>
    <link>http://xor.zoku-sei.com/Entry/81/</link>
    <pubDate>Sun, 28 Nov 2021 00:08:07 GMT</pubDate>
    <guid isPermaLink="false">xor.zoku-sei.com://entry/81</guid>
  </item>
    <item>
    <title>AGC039 Graph partitionを解いてみた</title>
    <description>
    <![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 />
うーん、時間中には思いつかん。。。]]>
    </description>
    <category>atcoder</category>
    <link>http://xor.zoku-sei.com/Entry/79/</link>
    <pubDate>Sun, 06 Oct 2019 11:17:58 GMT</pubDate>
    <guid isPermaLink="false">xor.zoku-sei.com://entry/79</guid>
  </item>
    <item>
    <title>赤黒木をgoで実装してみた</title>
    <description>
    <![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>]]>
    </description>
    <category>go</category>
    <link>http://xor.zoku-sei.com/Entry/78/</link>
    <pubDate>Mon, 23 Sep 2019 01:24:22 GMT</pubDate>
    <guid isPermaLink="false">xor.zoku-sei.com://entry/78</guid>
  </item>

    </channel>
</rss>