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
| 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
| 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
| 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
| 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
| nkf timelog.csv | awk -v Date="2016/05/23" -F',' 'BEGIN{OFS="\t"}$2==Date{print$1,$4,$5,$6;d=$2;h+=$7;l++}END{;print l" Rows";print h"[h]",h/8"[day/man]";print d}' | tail -r | tee >(tail -n+4 | pbcopy) | |
| pbpaste | sed -E -e $'s/^[\t\s]*//' | awk -F'\t' '$2~/[0-9]{4}\/[0-9]{2}\/[0-9]{2}/' | awk -F'\t' '{k=$2;gsub(/\//,"",k);d[k]=$2;r[k]=r[k]$1"\t"$4"\t"$5"\t"$6"\n";h[k]+=$7;l[k]++}END{OFS="\t";for(k in d){print d[k],h[k]"[h]",h[k]/8"[day/man]",l[k]" Rows";print r[k]}}' |
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
| defaults write -g InitialKeyRepeat -int 12 | |
| defaults write -g KeyRepeat -int 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
| # Mac | |
| brew install xz coreutils findutils homebrew/dupes/diffutils homebrew/dupes/grep gnu-sed gawk gnu-tar parallel nkf jq nmap openssl | |
| $(brew --prefix coreutils)/libexec/gnubin | |
| $(brew --prefix findutils)/libexec/gnubin | |
| $(brew --prefix gnu-sed)/libexec/gnubin | |
| $(brew --prefix gawk)/bin | |
| # Other | |
| # GNU Parallel |
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 '2016/03/21' '振替休日'; | |
| curl -s http://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv | | |
| nkf | | |
| gtail -n+3 | | |
| gawk -F',' '$2{print$2,$1}{fflush()}' | | |
| while read d s; do echo "$(gdate -d"$d" +'%Y/%m/%d') $s"; done; | |
| gseq 20160101 20161231 | | |
| gdate -f - +'%Y/%m/%d %w' 2> /dev/null | | |
| gawk '$2=="0"{print$1,"日曜日"}$2=="6"{print$1,"土曜日"}{fflush()}'; | |
| } | gsort -k1,1 -u |
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
| E0="ズン";E1="ドコ";while :;do eval echo "\$E$(($(od -vAn -N1 -tu4</dev/random)%2))";done|awk '{print}/ズン/{z++}/ドコ/{if(4<=z){print"キ・ヨ・シ!";exit(0)};z=0}'|tr '\n' ' ';echo |