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
| echo '{"hoge":99, "children":[{"hoge":3},{"hoge":255}]}' | jq -r 'leaf_paths | map(if type=="number" then "["+tostring+"]" else "."+tostring+"" end) | join("")' |
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
| date +%Y%m%d%H%M%S | |
| date '+%F %T' |
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
| curl http://www.data.jma.go.jp/fcd/yoho/typhoon/statistics/landing/landing.csv | nkf -wLux > landing.csv | |
| # Q1 | |
| gcat landing.csv | gtail -n+2 | gawk -F',' '{y=$1;for(m=1;m<=12;m++){printf("%04d%02d %d\n",y,m,$(m+1))}}' > monthly_typhoon | |
| # Q2 | |
| diff <(gcat monthly_typhoon | gawk '{a[substr($1,0,4)]+=$2}END{for(i in a){print i,a[i]}}' | gsort -k1,1) \ | |
| <(gcat landing.csv | gtail -n+2 | gawk -F',' '!$NF{$NF=0}{print $1,$NF}') | |
| # Q3 |
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
| find ~/.vagrant.d/boxes/ -name master_id | xargs rm |
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
| #!/bin/bash | |
| SCRIPT_NAME="$(basename $0)" | |
| usage() | |
| { | |
| echo "Parallel HTTP downloader" | |
| echo "Usage: ${SCRIPT_NAME} url [division]" | |
| } |
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
| # 時間ごと集計 | |
| seq 10 | awk '{t=$1} t0&&t!=t0{print t0,a; a=0} {a++;t0=t}' |
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
| mkfifo response; cat response | wsta ws://echo.websocket.org | tee /dev/tty | mybotscript | tee response |
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
| lsof -oo 20 $FILE |
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
| #!/bin/bash | |
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 repolist all | |
| # リポジトリ無効 | |
| yum-config-manager --disable $REPOS | |
| # 一時的にリポジトリを利用する | |
| yum --enablerepo $REPOS install $PACKAGE |