ハイパーシェル芸クリエイター(※自称ではない)キュアエンジニア
This file contains 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
paste <(cat /dev/urandom | gtr -dc '0-9' | fold -w 1 | head -n 11) <(echo 2 3 4 5 6 7 2 3 4 5 6 | rev | tr ' ' '\n') | \ | |
awk '{n=n"\n"$1; s+=$1*$2} END {c=(s%11); if(c<=1){print 0}else{print 11-c} print n}' | awk NF | xargs |
This file contains 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 {1,2,3}{1,2,3}{1,2,3}'\n' | awk '$1=$1' | sed -nr '/(.)(.?)\1/!p' | |
123 | |
132 | |
213 | |
231 | |
312 | |
321 | |
$ echo 1 2 3 | egison -F1,1c -T -m '(match-all-lambda (multiset integer)[<cons $a <cons $b <cons $c _>>> [a b c "#_EOF_#"]])' | sed -r 's/\t"#_EOF_#"\t?/\n/g' | awk -F '\t' '$1=$1' | |
1 2 3 |
This file contains 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
2016-01-01 金 元日 1 | |
2016-01-02 土 三が日 1 | |
2016-01-03 日 三が日 1 | |
2016-01-04 月 平日 0 | |
2016-01-05 火 平日 0 | |
2016-01-06 水 平日 0 | |
2016-01-07 木 平日 0 | |
2016-01-08 金 平日 0 | |
2016-01-09 土 休日 1 | |
2016-01-10 日 休日 1 |
This file contains 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
# Q https://twitter.com/tmnghryk/status/700073381454974976 | |
# A | |
time while true; do factor {2..100} | awk '$0*=!$3' | xargs | perl -anlE '{for (@F) { $i=int(rand(2)); $su[$i]+=$_; $s[$i].="$_ "} }END{say "$s[0]: $su[0]\n$s[1]: $su[1]"}' | grep -E '530$' && break ; done |
This file contains 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
((match-lambda | |
(list string) {[ | |
<join $a | |
(loop $i [1 4] | |
<cons (& ,"ズン" $z_i) ...> | |
(& <cons ,"ドコ" _> $d))> [a z (car d) "キ・ヨ・シ ♪"]]}) | |
(map 1#(R.car {"ズン" "ドコ"}) nats)) | |
# 結果 |
This file contains 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
川崎,始発 尻手,各停 矢向,各停 鹿島田,快速 平間,各停 向河原,快速 武蔵小杉,快速 武蔵中原,快速 武蔵新城,快速 武蔵溝ノ口,快速 津田山,各停 久地,各停 宿河原,各停 登戸,快速 中野島,各停 稲田堤,快速 矢野口,各停 稲城長沼,快速 南多摩,快速 府中本町,快速 分倍河原,快速 西府,快速 谷保,快速 矢川,快速 西国立,快速 立川,始発 |
This file contains 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
; num-to-digits from egison-libs https://github.com/egison-libs/project-euler | |
(define $num-to-digits | |
(lambda [$n] | |
(map 1#(read (pack {%1})) (unpack (show n))))) | |
(define $soul-sum | |
1#(match (num-to-digits %1) (list integer) | |
{[<cons $s ,{}> s] | |
[<cons $a $b> (soul-sum (foldl + a b))]})) |
This file contains 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
ctggggaaatctacagggcaccccaaaaaccactgcaggagaggccgcttgagggatccccggggaaacctcaagcgaatctgggaagggagcgtacctgggtcgatcgtgcgcgttggaggagactccttcgtagcttcgacgcccggccgcccctcctcgaccgcttgggagactacccggtggatacaactcacgcggctcttacctgttgttagtaaaaaaaggtgtccctttgtagcccct |
This file contains 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
#!/usr/bin/env egison | |
(define $main | |
(lambda [$args] | |
(each display (divnum (read (car args)))))) | |
(define $divnum | |
(lambda [$n] | |
(unique | |
(match-all (take n (repeat1 1)) (list integer) | |
[(loop $i [1 n] <join $a_i ...> <nil>) |