Skip to content

Instantly share code, notes, and snippets.

@caprest
caprest / one_liner.md
Last active August 23, 2018 05:40
ワンライナーメモ

want to unzip certain files in a directory

$ for val in find . -maxdepth 1 -name "*.zip"; do unar $val ; done

Want to convert encoding of all files under the directory (e.g. *.c or *.h)

find . -type f -regextype posix-basic -regex ".*.[c|h]" -exec nkf -Lu -w --overwrite {} ; Lu convert to LF, Lw convert to CRLF -w convert to utf8

@caprest
caprest / env.md
Last active September 7, 2018 13:00
環境構築メモ
@caprest
caprest / huga.md
Last active October 25, 2017 00:36
コマンドメモ

shell

  • ファイルの中から文字列検索 find ./ -type f -print | xargs grep 'hoge'

tmux

  • tmuxでprefixの確認 tmux show-options -g prefix
  • tmuxでセッションに名前をつけて起動 tmux new -s my_session
  • セッション名を指定してアタッチ tmux a -t my_session
@caprest
caprest / hoge.md
Created October 9, 2017 15:30
pythonのあれ

大前提

pythonの代入はすべて参照渡しらしいが、参照先での値変更について挙動がいろいろと異なるらしい。 pythonのオブジェクトはimmutable(変更不可)なものと、mutable(変更可能)なものがあり、mutableなものについては、参照先で値が変更されると元のオブジェクトの値も変更されるようだ。

結論から言うと以下の挙動はlistがmutableで、intがimmutableなことからおこるらしい。

a = [0]*3