Skip to content

Instantly share code, notes, and snippets.

@Iruyan-Zak
Created December 2, 2017 08:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Iruyan-Zak/186ce5d5cf8164744721dbf2f9326ef1 to your computer and use it in GitHub Desktop.
Save Iruyan-Zak/186ce5d5cf8164744721dbf2f9326ef1 to your computer and use it in GitHub Desktop.
12/02にシェル芸勉強会で発表した内容です。
echo -ne '🍣 sed 🍣 で始める簡単ループエンジン ' | sed -E ':b;p;s/(.)(.*)/\2\1/;bb'| xargs -i bash -c 'sleep 0.2 && echo -ne \\r{}'
echo '初期条件' | sed -nE ':b; /終了条件|.{20}/b; p; s/$/更新式/; bb'
echo _ _ | sed -nE ':b; p; s/(_*) (_*)/\2 \1\2/; bb' | sed 's/ .*//' | head -n20 | xargs -i sh -c 'echo {} | head -c-1 | wc -m'
echo 1 | sed -nE ':b;/[01]{5}/b;p;s/^/1+/;s/$/@0@/;tadd1;:add1;s/([01]*)([01])(\+[01]*)([01])@/\1\3@\2\4/;s/@((.?)(.)|(.)(.?))(\3|\4)(.?)@/@\3\4@\2\5\7/;tadd1;s/([01]*)?\+/\1/;tadd2;:add2;s/1@1@/@1@0/;tadd2;s/0@1/@1/;s/@([01])?@/\1/;bb' | sed 's/$/_/;:b;s/^.//;/^[01]/!b;s/_/__/g;/^1/s/$/_/;bb' | xargs -i sh -c "echo {} | head -c-1 | wc -m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment