View 第45回シェル芸勉強会_情報共有用
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
問題のリンク | |
https://b.ueda.tech/?post=20191228_shellgei_45_q | |
問題データのgitリポジトリ | |
https://github.com/ryuichiueda/ShellGeiData.git | |
取得コマンド | |
$ git clone https://github.com/ryuichiueda/ShellGeiData.git | |
シェル芸勉強会過去問 |
View 第45回シェル芸勉強会_情報共有用
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
a |
View 第45回シェル芸勉強会_情報共有用
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
a |
View gist:0f5df99128adb55434a5eeb5fd883499
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
シェル芸bot作者さんが作られた、下記うんこチャレンジツイートのawkバージョンだぜ! | |
140文字に入らなかったのでGistに載せておきましたよ・・・ | |
https://twitter.com/theoldmoon0602/status/945283544682610692 | |
同じような考え方でawk使って実装してみたのがこちら。 | |
``` | |
$ yes う ん こ | awk 'BEGIN{srand()}{i=int(rand()*10)%3+1; print $i}' | awk '{s=$0 s;print $0; if(substr(s,0,3)=="こんう"){exit;}}' | tr -d '\n';echo "つるん"; | |
ううこんんここうううんううこんんうううこんううこんううんうんううんこつるん | |
``` |
View gist:63f8817e4100c246d37737d1e5e24cbc
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
元ネタ: | |
https://twitter.com/kooshin/status/900923276049891328 | |
http://www.itmedia.co.jp/news/articles/1709/07/news106.html | |
シェル芸で再現版: | |
https://twitter.com/grethlen/status/906154326975905793 | |
https://gist.github.com/greymd/79ebdeb31ea08538c76e546ae469ced6 | |
https://twitter.com/ryuichiueda/status/906289652381786112 | |
pingで「にゃーん」のやつ、Rubyでも再現してみたよ。Ciscoルータ持ってない人もこれでほっこり。シェル芸で再現してる人もいるよ。 |
View gist:213ef730968f749d7d6b640aa79db10e
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
Q2解答例 | |
$ unzip -p 20141019OSC_LT.pptx 'ppt/slides/slide*' | grep -o 危険 | wc -l | |
17 | |
Q4暫定解答 | |
ポイント:正規表現の最長一致 | |
$ unzip -p 20141019OSC_LT.pptx ppt/slides/slide7.xml | gsed 's/<a:p>/\n&/g' | grep '^<a:p>' | sed 's;<[^<>]*>;;g' | |
Q5暫定解答 | |
ポイント:正規表現の最長一致 |
View search_prime
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
<<<10進数140桁の素数を見つけ出す>>> | |
opensslコマンドをフィルタとして活用する。出力の行頭に OpenSSL> というプロンプトが付いてくるのが邪魔ね。 | |
<<地道に順番に見つけ出す>> | |
# Mac (coreutilsとGNU sedを利用) | |
$ yes '0 9' | head -n 140 | rs -T | tr -d ' ' | sed '1s/0/1/' | xargs gseq | gsed -u 's/^/prime /' | openssl | grep --line-buffered -v not | awk '{print $2;fflush()}' | (echo 'obase=10;ibase=16'; cat) | BC_LINE_LENGTH=200 bc | |
## Ubuntu | |
$ yes '0 9' | head -n 140 | rs -T | tr -d ' ' | sed '1s/0/1/' | xargs seq | sed -u 's/^/prime /' | openssl | grep --line-buffered -v not | awk '{print $2;fflush()}' | (echo 'obase=10;ibase=16'; cat) | BC_LINE_LENGTH=0 bc |
View randomfill
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
元ネタはこちら。面白い! | |
http://raintrees.net/news/93 | |
https://twitter.com/kanata201612/status/806475573824360448 | |
https://twitter.com/kanata201612/status/806477105974259712 | |
https://twitter.com/kanata201612/status/806841499673444353 | |
元ネタをawkでやってみた。awkだと速すぎるのでsleepで遅く調整。終了はCtrl-cで。 | |
最初にカーソルを消しているので、終了後は tput init を実行しよう。 | |
・tput cols 端末の幅(列数) |
NewerOlder