This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys, re | |
if len (sys.argv) < 3: | |
sys.exit ("Usage: %s auto gold" % sys.argv[0]) | |
def collect_info (fn): | |
sep = re.compile (r'(?:\t|\s)*') | |
chunk, depnd = [], [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, re | |
r_sum = re.compile(r'\((\d+)/(\d+)\)') | |
acc, param = [], [] | |
for line in sys.stdin: | |
if line.split()[0] in (['precision:', 'recall:', 'sent']): | |
m = r_sum.findall(line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env/python | |
# Usage: knbc2cabocha.py [format] | |
# convert KNB corpus to CaboCha format | |
import sys, re | |
header, data, head, body, t2c = "", "", [], [], {} | |
pat_d = re.compile (r'^\d+') | |
pat_s = re.compile (r'\s+') | |
for line in sys.stdin: | |
if line[0] == '#': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set encoding=utf8 | |
set number | |
set paste | |
set expandtab | |
set textwidth=0 | |
set tabstop=4 | |
set softtabstop=4 | |
set shiftwidth=4 | |
set autoindent | |
set backspace=indent,eol,start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum install -y gcc patch openssl-devel zlib-devel bzip2-devel readline-devel sqlite-devel | |
curl -kL https://bootstrap.pypa.io/get-pip.py | python | |
pip install --upgrade pip | |
git clone https://github.com/yyuu/pyenv.git ~/.pyenv | |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile | |
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile | |
exec -l $SHELL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 本家をクローン | |
[root@docker-host gitbucket_workspace]# git clone https://github.com/......../fork-test.git | |
[root@docker-host gitbucket_workspace]# cd fork-test/ | |
[root@docker-host fork-test]# git tag | |
release_0.0.1 | |
release_0.0.2 | |
[root@docker-host fork-test]# git branch | |
* master | |
[root@docker-host fork-test]# git branch -a | |
* master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MySQLdb | |
import itertools | |
from random import randrange, choice | |
spot_ddl = """ | |
CREATE TABLE IF NOT EXISTS spot ( | |
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, | |
name VARCHAR(10) NOT NULL, | |
seq INT NOT NULL | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
from bson.dbref import DBRef | |
from collections import OrderedDict | |
from random import randrange, choice | |
client = pymongo.MongoClient() | |
test = client.test | |
spot = test.spot | |
play = test.play |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION `zip`(_first text, _second text, _separator text, _pair_separator text) RETURNS text CHARSET utf8 | |
BEGIN | |
DECLARE _ret text; | |
IF 0 < LENGTH(_first) THEN | |
SELECT | |
GROUP_CONCAT( | |
CONCAT_WS( | |
_pair_separator, | |
REPLACE(SUBSTRING_INDEX(v.`first`, _separator, p.rownum), CONCAT(SUBSTRING_INDEX(v.`first`, _separator, p.rownum - 1), _separator), ''), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IdWorker { | |
long workerBits = 5L; | |
long datacenterBits = 5L; | |
long sequenceBits = 12L; | |
long workerIdShift = sequenceBits; | |
long datacenterIdShift = sequenceBits + workerBits; | |
long timestampLeftShift = sequenceBits + workerBits + datacenterBits; | |