View gist:cc4a957f45f3cc598c6a
curl -so- www2.infonets.hiroshima-u.ac.jp/dicomo/program/program.html | nkf -w | grep green | grep 著者 | sed 's/).*//' | sed 's/.*(//' | sort | uniq -c | sort -nr |
View CygwinOpen.bat
set cdpath=%~1 | |
set escapedPath=%cdpath:\=\\% | |
start C:\cygwin64\bin\mintty.exe /bin/bash -lc "cd '%escapedPath%'; exec bash" |
View CygwinOpen.reg
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\Directory\Background\shell\CygwinOpen] | |
"NoWorkingDirectory"="" | |
@="CygwinOpen" | |
[HKEY_CLASSES_ROOT\Directory\Background\shell\CygwinOpen\command] | |
@="C:\\cygwin64\\CygwinOpen.bat \"%V\"" |
View apt-cyg_install.sh
wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg -P /usr/bin && chmod 755 /usr/bin/apt-cyg |
View gist:a6933f2472b888a75014
# 南武線の駅の中で、快速→各停→快速 となっている不憫な並びの3駅を抽出するegisonシェル芸。 | |
curl -so- -L goo.gl/4Gl1BL | tr ',\n' '\t' | egison -F 1cs -m '(match-all-lambda (list something) [ <join _ <cons $x <cons ,"快速" <cons $y <cons ,"各停" <cons $z <cons ,"快速" >>>>>>> [x y z]] )' | |
# [Result] | |
# {["鹿島田" "平間" "向河原"] ["登戸" "中野島" "稲田堤"] ["稲田堤" "矢野口" "稲城長沼"]} | |
# | |
# 既存のgrep等による単純な文字列マッチでは難しいオーバーラップしたパターンをループなしで検出できる。 | |
# curlで習得する文字列には「稲田堤」はひとつしか含まれていないが、 | |
# 例では稲田堤がオーバーラップしている。 |
View gist:26892f933d21dd84c2ac
w3m -dump http://www.asahi-net.or.jp/~tk7m-ari/sazae_ichiran.html | \ | |
sed 's/(.*//g' | awk NF | awk '$0=$1" "$3' | sed -n '4,$p' | tr ' ' '\t' | \ | |
egison -T -F1s -s '(match-all-lambda | |
(list [string string])[ | |
<join _ <cons [$a $te1] | |
<cons [$b $te2] | |
<cons [$c ,te1] | |
<cons [$d ,te2]>>>> _> | |
[a b c d "=>" te1 te2 te1 te2] | |
])' | column -t |
View gist:352f9a6ec70d2a5f607f
# 形態素解析器を使うのでmecabを事前にインストールされたし | |
# % brew install mecab | |
# 青空文庫から「走れメロス」を取得 | |
$ w3m -dump http://www.aozora.gr.jp/cards/000035/files/1567_14913.html | \ | |
mecab | awk -F',' '$0=$1' | awk 'NF==2' | \ | |
egison -F1s -s '(match-all-lambda (list [string string])[<join _ <cons [$a ,"名詞"] <cons [$b ,"助詞"] <cons [$c ,"名詞"] <cons [$d ,"動詞"] <cons [$e ,"助動詞"]>>>>>> [a b c d e]])' | |
# Result | |
# ["メロス" "は" "激怒" "し" "た"] |
View gist:db0ec53d0221d1d76b49
# Macの場合shufではなくgshufをつかってください。 | |
yes | xargs bash -c "echo {'♦','♥','♣','♠'}' '{1..13} | xargs -n 2 | tr ' ' '\t' | shuf" | \ | |
egison -F1,1s -s '(match-all-lambda | |
(multiset [string integer])[ | |
<cons [$s $n] | |
<cons [,s ,(- n 1)] | |
<cons [,s ,(- n 2)] | |
<cons [,s ,(- n 3)] | |
<cons [,s ,(- n 4)] |
View gist:93d495bd3cca88e31dae
#/bin/bash | |
#NUMが大きいほど精度がよくなる | |
NUM=50; paste <(seq 1 2 $NUM) <(seq $NUM) | \ | |
awk 'NF==2' | awk '{print $1"+ "$2"^2/"}' | \ | |
xargs | awk '$0="4/ "$0" 1"' | xargs -n 1 | \ | |
sed 's/^/(/g'| perl -anle '{print $_}END{print ")" x $.}' | \ | |
xargs | awk '$0="scale=20;"$0' | bc |
View gist:c586bbbcfd4904178257
# GNU版grepを利用 | |
echo 2" "{1..2015}$'\n' | awk NF | while read m y; do echo -n "$y年"; cal $m $y | awk NF | sed -n -e '3,3p' -e '$,$p' | tr -d '\n' | awk '$0=":"NF' ;done | grep -oP ".+(?=:13)" | |
#ピッタリと収まる例 | |
# $ cal 2 2015 | |
# February 2015 | |
# Su Mo Tu We Th Fr Sa | |
# 1 2 3 4 5 6 7 | |
# 8 9 10 11 12 13 14 | |
# 15 16 17 18 19 20 21 |
OlderNewer