Skip to content

Instantly share code, notes, and snippets.

View yubessy's full-sized avatar

Shotaro Tanaka yubessy

View GitHub Profile
@yubessy
yubessy / sql_style1.py
Created June 3, 2014 03:20
Pythonコードの中に複数行SQLを書く ref: http://qiita.com/yubessy/items/86032d332ac86c1abe67
sql_stmt = "CREATE TABLE Test(" \
"id INTEGER PRIMARY KEY, " \
"val TEXT NOT NULL)"
@yubessy
yubessy / file1.txt
Last active August 29, 2015 14:01
PythonのbottleでBASIC認証 ref: http://qiita.com/yubessy/items/33789eccb35b659b0b4e
$ python hello.py
@yubessy
yubessy / Default (OSX).sublime-keymap
Last active August 29, 2015 14:01
Sublime Text 2でコマンドパレットのコマンドにショートカットキーを割り当てる ref: http://qiita.com/yubessy/items/546fc167e6c6c248415b
[
{
"keys": ["command+_"],
"command": "run_emmet_action",
"args": {
"action": "merge_lines"
}
}
]
@yubessy
yubessy / file0.txt
Last active August 29, 2015 14:00
PythonでExcelファイルを作成 + similarity matrix ref: http://qiita.com/yubessy/items/a39a565cdc2c5872cce9
$ pip install xlsxwriter
@yubessy
yubessy / corenlp_example.py
Last active August 29, 2015 14:00
Stanford CoreNLPをPythonから使う ref: http://qiita.com/yubessy/items/1869ac2c66f4e76cd6c5
import pprint
import json
import corenlp
# パーサの生成
corenlp_dir = "/usr/local/lib/stanford-corenlp-full-2013-06-20/"
parser = corenlp.StanfordCoreNLP(corenlp_path=corenlp_dir)
# パースして結果をpretty print
result_json = json.loads(parser.parse("I am Alice."))
@yubessy
yubessy / file0.txt
Last active August 29, 2015 14:00
Python2のstr/unicodeとencode/decode ref: http://qiita.com/yubessy/items/9e13af05a295bbb59c25
>>> 'あいう'
'\xe3\x81\x82\xe3\x81\x84\xe3\x81\x86'