Skip to content

Instantly share code, notes, and snippets.

View ts-3156's full-sized avatar
🌴
On vacation

ts-3156 ts-3156

🌴
On vacation
View GitHub Profile
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @resurrect-capture-pane-contents 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
#!/bin/bash
base_dir=`pwd`
wget -O mecab-0.996.tar.gz "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE"
tar zxfv mecab-0.996.tar.gz
cd mecab-0.996
./configure --enable-utf8-only
make
make check
banner=no
color_patches=no
plain=off
newtext=green
oldtext=cyan
diffstuff=yellow
cvsstuff=white
@ts-3156
ts-3156 / .inputrc
Last active September 13, 2016 01:40
$if mysql
"\C-xd": "SHOW DATABASES;"
"\C-xt": "SHOW TABLES;"
"\C-gv": "SHOW GLOBAL VARIABLES LIKE '%%';"
"\C-gs": "SHOW GLOBAL STATUS LIKE '%%';"
"\C-xp": "SHOW PROCESSLIST;"
"\C-xs": "SELECT table_name, engine, table_rows as tbl_rows, avg_row_length as rlen, floor((data_length+index_length)/1024/1024) as allMB, floor((data_length)/1024/1024) as dMB, floor((index_length)/1024/1024) as iMB FROM information_schema.tables WHERE table_schema=database() ORDER BY (data_length+index_length) DESC;"
$endif
@ts-3156
ts-3156 / .editrc
Last active September 13, 2016 01:30
mysql:bind -s "^xd" "SHOW DATABASES;"
mysql:bind -s "^xt" "SHOW TABLES;"
mysql:bind -s "^gv" "SHOW GLOBAL VARIABLES LIKE '%%';"
mysql:bind -s "^gs" "SHOW GLOBAL STATUS LIKE '%%';"
mysql:bind -s "^xp" "SHOW PROCESSLIST;"
mysql:bind -s "^xs" "SELECT table_name, engine, table_rows as tbl_rows, avg_row_length as rlen, floor((data_length+index_length)/1024/1024) as allMB, floor((data_length)/1024/1024) as dMB, floor((index_length)/1024/1024) as iMB FROM information_schema.tables WHERE table_schema=database() ORDER BY (data_length+index_length) DESC;"
var jsBase64 = (function() {
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
// public method for encoding
function encode(data) {
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc = "",
tmp_arr = [];
if (!data)
@ts-3156
ts-3156 / social_counts.js
Created August 9, 2013 03:14
facebook、twitter、はてなブックマークで共有された数を集計するJavaScript
function insertScript(url) {
var target = document.createElement('script');
target.charset = 'utf-8';
target.src = url;
document.body.appendChild(target);
}
function likeCount(_url) {
var pageURL = (_url) ? _url : location.href;
pageURL = encodeURIComponent(pageURL);
@ts-3156
ts-3156 / diff_users.rb
Created June 15, 2013 22:41
Aグループには含まれているが、Bグループには含まれていないユーザー一覧を取得するためのメソッド。 単純な二重ループにすると時間がかかりすぎるためhashを用いて比較回数を減らしている。 inverse_hashあたりはもっと最適化の余地があるが、そこそこ最適化できれば充分なのでこのような実装にした。 Aグループ、Bグループともに約1,000ユーザーで実行時間を計測した時、単純な二重ループだと約60~70秒、 この実装だと1秒未満、になった。
# pre_usersには存在するが、cur_usersには存在しないユーザーの配列を返す
# 単純な総当たりにすると比較回数が多くなり時間がかかりすぎるので
# hashを利用して比較回数を減らしている。
def diff_users(pre_users, cur_users)
return [] if (!pre_users || !cur_users)
target_users = []
pre_users_hash = {}
pre_users.each_with_index{|pre_user, i|
@ts-3156
ts-3156 / .inputrc
Last active December 16, 2015 11:29
# for linux
#source /etc/inputrc
# type Ctrl+V
# type the key sequence you are interested in (e.g., Alt+→). This would print ^[[1;3C
# remove the leading ^[ and replace it with \e to make \e[1;3C
# place this value in your .inputrc file.
"\eOC": forward-word
@ts-3156
ts-3156 / .vimrc
Last active December 2, 2016 07:13
" source /etc/vimrc
" mkdir -p ~/.vim/bundle
" git clone git://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim
if has("autocmd")
augroup redhat
autocmd FileType * :set formatoptions=q
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *