Skip to content

Instantly share code, notes, and snippets.

@akiniwa
akiniwa / .gitconfig
Last active December 16, 2015 06:48
Git Tips(.gitconfig)
# プロキシ下でのgit設定。
git config --global http.proxy http://www-proxy.example.net:8080/
# コミット履歴をtree表示。
[alias]
tree = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C( reset)' --abbrev-commit --date=relative
# エディターの設定。
[core]
editor = /usr/bin/vim
@akiniwa
akiniwa / .bash_profile
Last active December 17, 2015 01:39
androidのデバッグでjavaのエラーを日本語で出力する。
export SETUP_SH_VMARGS="-Dfile.encoding=UTF8"
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
alias javac='javac -J-Dfile.encoding=UTF-8'
alias java='java -Dfile.encoding=UTF-8'
export _JAVA_OPTIONS='-Dfile.encoding=UTF-8'
@akiniwa
akiniwa / gist:5931654
Last active December 19, 2015 09:18
How to start virtualenv.
$ virtualenv ENV #create virtual directly which includes local library and so on.
$ cd ENV
$ source bin/activate #activate virtual directly
You can see installed modules by
$ pip list
@akiniwa
akiniwa / hello.c
Created July 5, 2013 04:45
実行ファイルがコンパイル結果を実行する。
#if 0
#!/bin/sh
gcc -o hello hello.c
./hello
exit
#endif
#include <stdio.h>
int main( void )
@akiniwa
akiniwa / gist:5931855
Last active December 19, 2015 09:19
centos Tips.
$ usermod -G wheel Taro # wheel グループにTaroを追加。
$ cat /etc/passwd # centos内のユーザーを表示。
$ tail -f /var/log/php_errors.log # phpのエラーログを表示。
@akiniwa
akiniwa / gist:5933981
Created July 5, 2013 11:39
ssh Tips.
ssh-keygen -t rsa -C "sample@gmail.com"
@akiniwa
akiniwa / gist:5933992
Created July 5, 2013 11:41
git Tips.
git remote add foo git@github.com:akiniwa/hogesitory.git
$ lha e dom.lzh
@akiniwa
akiniwa / string.py
Last active December 19, 2015 23:49
python, listとdictionaryでよく使うもの。
l = [] #空のリスト
l = list() #空のリスト
l = ["h", "e", "l", "l", "o"]
l.append(",") #最後に追加
index = l.index("o") #要素の番号を返す
l.insert(index, "BOB") #indexに"BOB"を挿入
l.pop() #最後の要素を削除
l.remove("h") #要素"h"を削除
del(l[0:3]) #0, 1, 2番の要素を削除
@akiniwa
akiniwa / forJson.py
Last active December 19, 2015 23:49
jsonのロード
import json
j1 = json.load(open("sample1.json"))
type(j1)
j2 = json.load(open("sample2.json"))
type(j2)
print j2["item"][0]["itemName"]