Skip to content

Instantly share code, notes, and snippets.

VIM
In Vi Improved to change or set desired syntax highlighting mode to MODE you have to type in VIM's command line:
:set syntax=MODE
It is very usefull when your file does not have standard extension or you are editting file with two languages in it, eg. AWK commands in a BASH script.
You can set AWK mode :set syntax=awk
@libitte
libitte / diff_between_hadoop_dfs_and_hadoop_fs.md
Created February 13, 2014 12:45
`hadoop dfs` と `hadoop fs` の違い
  • 配列の差分

@A - @B

my @A = qw(1 2 3 4 5 6 7 8 9);
my @B = qw(3 5 9);
 
my %cnt = ();
map { $cnt{$_}-- } @B;

user ごとの 件数のうち最大件数をしらべる

SELECT MAX(counted) FROM
(
SELECT COUNT(*) AS counted
FROM table_actions
WHERE status = "good"
@libitte
libitte / commit_log_should_current.md
Last active August 29, 2015 13:56
commit log は過去形?現在形?

commit log は過去形?現在形?

現在形 が望ましい。 プログラマが、Gitのレポジトリに対して、このようにふるまいを変えろと命令している様をイメージすればよい。

Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour. Try to make sure your explanation can be understood without external resources.

== 10進法 -> 2進法, 2進法 -> 10進法
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1210460042
- 2 -> 10
ex) 1111001
1*2^6 + 1*2^5 + 1*2^4 + 1*2^3 + 1*2^0
64+32+16+8+1
# git の branch 名を表示する方法
#.bashrc
# git settings
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ '
ls, buffers, files 開いているバッファ一覧(バッファリスト)を表示する
bfirst,bf 先頭のバッファに移動する
blast,bl 最後のバッファに移動する
bnext,bn 次のバッファに移動する
bprev,bp 前のバッファに移動する
b NUM NUM番目のバッファに移動する
badd バッファにファイルをロードする
bdelete バッファをアンロードする
http://soramugi.hateblo.jp/entry/2013/12/01/150433
http://qiita.com/soramugi/items/7014c866b705e2cd0b95
tagsファイルがおいてあるディレクトリのソースコードをvim開く
定義したクラスや関数名の上で Ctrl+] を押すと、クラスや関数の定義元に移動できる
前の場所に戻る時は Ctrl+t もしくは Ctrl+o を押すか、:pop を実行する
他に、ctagsを利用する上で覚えておくと便利な点は以下の通り
C-w}でプレビューウィンドウで開ける。プレビューウィンドウは C-wC-z もしくは :pc で閉じることができる
:tags を実行することで、タグの移動経路を事前に確認することができる
@libitte
libitte / gist:50481664243ecd35ca14
Last active August 29, 2015 14:02
login shell を homebrew でインストールした zsh に変更
chsh -s /usr/local/bin/zsh