Skip to content

Instantly share code, notes, and snippets.

@hiropppe
hiropppe / solarized mac
Last active March 21, 2017 18:56
macのカラーをsolarizedにした [環境メモ]
[ terminal ]
https://github.com/tomislav/osx-terminal.app-colors-solarized
$ git clone https://github.com/tomislav/osx-terminal.app-colors-solarized solarized.git
1. ターミナル > 環境設定
2. プロファイル > 歯車 > 読み込む...
3. ダウンロードした、Solarized Dark.terminal Solarized Light.terminal を読み込む
[ vim ]
@hiropppe
hiropppe / nb.py
Last active February 2, 2016 14:51
Naive Bayes Classifier Implementation Sample
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
import math
import sys
from collections import defaultdict
class NB:
yum install -y rubygems ruby-devel
gem install wp2txt
curl -O https://dumps.wikimedia.org/jawiki/latest/jawiki-latest-pages-articles1.xml.bz2
wp2txt --input-file jawiki-latest-pages-articles1.xml.bz2
cat jawiki-latest-pages-articles1.xml-* > corpus.txt
from gensim.models import word2vec
sentences = word2vec.Text8Corpus("corpus_wakati.txt")
model = word2vec.Word2Vec(sentences, min_count=1, size=100)
model[u'セール']
@hiropppe
hiropppe / knp_distsim.c
Last active June 16, 2016 06:07
knp distsim call test
/*
# VirtualBoxのディスクがIO負荷で(?)勝手にリードオンリーになった
VBoxManage setextradata "docker-host" "VBoxInternal/Devices/ahci/0/LUN0/Config/FlushInterval" 1000000
# 実行ファイル
gcc -DHAVE_CONFIG_H -I. -I.. -I/knp-4.16/CRF++-0.58 -I/knp-4.16/crf -DUSE_CRF -DKNP_DICT="\"/usr/local/share/knp/dict"\" -DKNP_RULE="\"/usr/local/share/knp/rule"\" -DKNP_RC_DEFAULT="\"/usr/local/etc/knprc"\" -DCF_VERSION="\"CF1.1"\" -DCDB -I/knp-4.16/cdb -I/usr/local//include -I/knp-4.16/distsim -g3 -O0 -MT dsim.o -MD -MP -MF .deps/dsim.Tpo -c -o dsim.o dsim.c
/bin/sh ../libtool --tag=CC --mode=link g++ -g3 -O0 -o dsim dsim.o tools.o db.o -lm /knp-4.16/distsim/libdistsim.la -lstdc++ -L/knp-4.16/cdb -lcdb -lz
# 共有ライブラリ
## distsim
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import sqlite3
import codecs
import Geohash
import pyproj
from collections import defaultdict
$ mkdir -p ~/.vim/bundle
$ git clone https://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim
"------------------------------------
" neocomplete.vim
"------------------------------------
"Note: This option must set it in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
import tables as tb
from scipy.sparse import lil_matrix
h5 = tb.open_file('sparse.h5', 'a')
data_group = h5.create_group(h5.root, 'data_group')
indices_group = h5.create_group(h5.root, 'indices_group')
indptr_group = h5.create_group(h5.root, 'indptr_group')