Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ASCII art oneliner

MSR
October 29, 2016

ASCII art oneliner

アスキーアート(突然の死、slコマンド、端末画面ぐちゃぐちゃ)をワンライナーでやってみた
※完全版

MSR

October 29, 2016
Tweet

More Decks by MSR

Other Decks in Technology

Transcript

  1. ΞεΩʔΞʔτ

    ϫϯϥΠφʔ
    @ୈ25ճγΣϧܳษڧձ େࡕαςϥΠτ (2016.10.29)
    MSR (@msr386)

    View full-size slide

  2. ໨࣍
    ➤ ࣗݾ঺հ
    ➤ ࠓ·Ͱͷ൓ল
    ➤ ΞεΩʔΞʔτͳγΣϧܳ (όφʔܳ)
    ➤ ಥવͷࢮ
    ➤ slίϚϯυ
    ➤ λʔϛφϧը໘Λ͙ͪΌ͙ͪΌʹ͢Δ
    ➤ ·ͱΊ

    View full-size slide

  3. ࣗݾ঺հ
    ➤ ϋϯυϧωʔϜ: MSR (@msr386)
    ➤ C++ϓϩάϥϛϯάɺαʔόʔӡ༻͕ಘҙ
    ➤ ٻ৬த
    ➤ Chromium Contributor (1ճ͚ͩ)
    ➤ Webϒϥ΢β࡞͍ͬͯ·͢ (http://app.tungsten-start.net/)

    View full-size slide

  4. ࠓ·Ͱͷ൓ল

    View full-size slide

  5. ͜Ε·Ͱͷࣗ෼ͷओͳ
    LTൃදΛৼΓฦΔͱ

    View full-size slide

  6. (1)Χφμͷങ͍੾ΓVPSͷ঺հ
    ӡ༻ʹ͸࢖͑ͳ͍͚ͲγΣϧܳ஁࿉ʹ͸ͽͬͨΓ?

    View full-size slide

  7. (2) QRίʔυγΣϧܳ?
    QRةݥγΣϧܳ / QRίʔυγΣϧܳͷՄೳੑΛ໛ࡧ

    View full-size slide

  8. ΄ͱΜͲγΣϧܳͱ
    ؔ܎ͳ͍͡ΌΜ
    (ΨνͷγΣϧܳ΍Ζ͏ͥ)

    View full-size slide

  9. ࠷ۙͷόφʔܳͱ͍͏
    ྲྀߦʹ৐Γ

    View full-size slide

  10. ΞεΩʔΞʔτγΣϧ
    ܳΛ΍Γ·͢

    View full-size slide

  11. 1. ಥવͷࢮ

    View full-size slide

  12. ΁ ?P?
    ΁

    ɹɹc΁

    ɹɹ

    View full-size slide

  13. ʘ ?P?
    ΁

    ɹʘc

    ɹɹɹʼ

    View full-size slide

  14. ʻ ?P?
    ʼ

    ɹࡾ

    ࡾ

    ʻʉʉʼ

    View full-size slide

  15. Є ?P?

    ɹʻ

    ʼάΩο

    ʻʉʉʼ

    View full-size slide

  16. ʊਓਓਓਓʊ

    ʼಥવͷࢮʻ

    ʉ:?:?:?:ʉ

    View full-size slide

  17. ಥવͷࢮ
    ➤ 2012೥ࠒɺͱ͋Δܝࣔ൘ʹॻ͖ࠐ·Εͨ΋ͷ͕ݩωλͱݴΘΕ͍ͯΔ
    ➤ ࠷ޙͷғΈจࣈͷΞεΩʔΞʔτ͚͕ͩΑ͘࢖ΘΕ͍ͯΔ
    ➤ 2013೥ʹTwitterͰվߦίʔυ͕ରԠ͔ͯ͠Βڻҟతʹ֦ࢄ
    ➤ ओͳಛ௃
    ➤ ൚༻ੑͷߴ͞
    ➤ ΞεΩʔΞʔτͷ୯७͞
    ➤ ݟͨ໨ͷྗڧ͞
    ➤ ʮಥવͷࢮδΣωϨʔλʔʯͱ͍͏໊લͰWebαʔϏεԽɺiOS΍Android޲͚ʹΞϓ
    ϦԽ͞Ε͍ͯΔ

    View full-size slide

  18. ಥવͷࢮɹγΣϧεΫϦϓτ൛͕ଘࡏ
    ➤ γΣϧεΫϦϓτ΋͋Δ (https://fumiyas.github.io/2013/12/25/echo-sd.sh-advent-calendar.html)
    $ echo -e "crontab -r\n突然の危険シェル芸" | echo-sd -s --center

    _人人人人人人人人人人人_

    >   crontab -r   <

    > 突然の危険シェル芸 <

    ‾Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^‾

    $ 

    $ echo-sd -v 縦書き

    _人人_

    > 縦 <

    > 書 <

    > き <

    ‾Y^Y^‾

    $

    View full-size slide

  19. ಥવͷࢮɹγΣϧεΫϦϓτ൛͕ଘࡏ
    ➤ ॎॻ͖ɺ୹࡭ɺετϨεൃੜաఔϞʔυɺπΠʔτػೳͳͲػೳ͕๛෋
    $ echo-sd --stress "crontab: no crontab for
    root" あれ?中身消えてる "(historyの結果)
    334 sudo crontab -r" "eとr押し間違い!バック
    アップない!!" 危険シェル芸


    crontab: no crontab for root

        ↘

       あれ?中身消えてる

        ⾫

    (historyの結果) 334 sudo crontab -r

        ↘

       eとr押し間違い!バックアップない!!

        ⾫

    _人人人人人人人人_

    > 危険シェル芸 <

    ‾Y^Y^Y^Y^Y^Y^Y^Y^‾
    $ echo-sd --tanzaku ":(){ :|:& };:"

    ┏-┷-┓

    ┃ ‥ ┃

    ┃ ⏜ ┃

    ┃ ⏝ ┃

    ┃ ⏞ ┃

    ┃  ┃

    ┃ ‥ ┃

    ┃ | ┃

    ┃ ‥ ┃

    ┃ & ┃

    ┃  ┃

    ┃ ⏟ ┃

    ┃ ; ┃

    ┃ ‥ ┃

    ┗━━┛

    View full-size slide

  20. ϫϯϥΠϯ࣮૷ɺ։࢝

    View full-size slide

  21. ࢝ΊΔલʹ
    ୯७ԽͷͨΊʹɺҎԼͷΑ͏ͳखൈ͖Λ͠·͢
    ➤ ౳෯ϑΥϯτʹಛԽ
    ➤ 1ߦ͚ͩରԠ

    ෳ਺ߦͰ͸ߟྀ͢΂͖͜ͱ͕૿͑ΔͨΊ
    ➤ શ֯จࣈ͚ͩରԠ

    ൒֯จࣈ͸ͱΓ͋͑ͣແࢹ͢Δ
    ➤ LANG=ja_JP
    .UTF-8 લఏ

    LANGʹΑΓจࣈ਺ܭࢉ͕͓͔͘͠ͳΒͳ͍Α͏ʹ͢ΔͨΊ

    View full-size slide

  22. ੍࡞աఔ
    1. ಛ௃Λଊ͑Δ
    _人人人人人人_

    > 突然の死 <

    ‾Y^Y^Y^Y^Y^Y^‾

    ಥવͷࢮ͸ɺจࣈ਺ʹԠ্ͯ͡෦ɺԼ෦ͷจࣈ਺͕มԽ͢Δ

    →্෦ʮਓʯͱԼ෦ʮY^ʯΛશ֯1จࣈʹରͯ͠1ݸͣͭ૿΍ͤ͹Α͍

    View full-size slide

  23. ੍࡞աఔ
    2. จࣈ਺Λௐ΂Δʹ͸?

    awkͷlength()Λ࢖༻͢Δ

    for (i=0; i※+2͸ࠨӈͷه߸ͱ༨ന
    3. printfͰ੔ܗ͢Δ

    printf("ʊ%sʊ\nʼɹ%sɹʻ\nʉ%sʉ\n", up, $0, dn)

    View full-size slide

  24. ಥવͷϫϯϥΠφʔ୯७൛
    $ echo 突然の死 | awk \

    '{for(i=0;i{up=up "人"; dn=dn "Y^"} printf( \

    "_%s_\n> %s <\n‾%s‾\n", \

    up, $0, dn)}'

    View full-size slide

  25. ಥવͷϫϯϥΠφʔ୯७൛ɹ࣮ߦྫ
    $ echo 突然の死 | awk '{for(i=0;iprintf("_%s_\n> %s <\n‾%s‾\n", up, $0, dn)}'

    _人人人人人人_

    > 突然の死 <

    ‾Y^Y^Y^Y^Y^Y^‾

    $

    $ echo Hankakuだとずれる | awk '{for(i=0;i"Y^"} printf("_%s_\n> %s <\n‾%s‾\n", up, $0, dn)}'

    _人人人人人人人人人人人人人人_

    > Hankakuだとずれる <

    ‾Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^‾

    $

    View full-size slide

  26. ಥવͷϫϯϥΠφʔ୯७൛ͷಛ௃ͱ໰୊఺
    ಛ௃
    ➤ awkҰൃܳ
    ➤ πΠʔτՄೳ(112จࣈ)
    ໰୊఺
    ➤ ൒֯จࣈࠞ͟ΔͱͣΕΔͷ͸खൈ͖͠ա͗͡Όͳ͍?

    ൒֯จࣈͰͣΕΔݪҼ͸ɺawkͷlength()ͷ࢓༷
    ➤ LANG؀ڥม਺ʹґଘ
    ➤ ja_JP
    .UTF-8ͷ৔߹ɺશ֯΋൒֯΋1Λฦ͢
    ➤ ͳΒ͹ɺશ֯͸2ɺ൒֯͸1Λฦͤ͹ͣΕͳ͍ΑͶ?

    View full-size slide

  27. ಥવͷϫϯϥΠφʔվྑ൛
    $ echo 突然の死 | awk \

    '{for(i=1;i<=length();i++){ \

    len+=(substr($0,i,1)~/[\x01-\x7E]/)?1:2} \

    for(i=0;iup=up "人";dn=dn "Y^"} \

    printf("_%s_\n> %s <\n‾%s‾\n", \

    up,$0,dn)}'

    View full-size slide

  28. ಥવͷϫϯϥΠφʔվྑ൛ɹ࣮ߦྫ
    $ echo 突然のワンライナーEx | awk '{for(i=1;i<=length();i++){len
    +=(substr($0,i,1)~/[\x01-\x7E]/)?1:2}for(i=0;i"Y^"}printf("_%s_\n> %s <\n‾%s‾\n",up,$0,dn)}'

    _人人人人人人人人人人人人_

    > 突然のワンライナーEx <

    ‾Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^‾

    $

    $ echo Hankakuでもずれは最小限 | awk '{for(i=1;i<=length();i++){len
    +=(substr($0,i,1)~/[\x01-\x7E]/)?1:2}for(i=0;i"Y^"}printf("_%s_\n> %s <\n‾%s‾\n",up,$0,dn)}'

    _人人人人人人人人人人人人人人_

    > Hankakuでもずれは最小限 <

    ‾Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^Y^‾

    $

    View full-size slide

  29. ಥવͷϫϯϥΠφʔվྑ൛ͷಛ௃
    ➤ վળ
    ➤ ൒͕֯ࠞͬͯ͟΋ͣΕͳ͍
    ➤ վѱ
    ➤ πΠʔτෆՄ

    View full-size slide

  30. վྑ൛ͷղઆ
    ➤ awkΛ੔ܗ͢Δͱ͜ͷΑ͏ʹͳΔ
    {

    for(i = 1; i <= length(); i++) {

    len += ( substr($0,i,1) ~/[\x01-\x7E]/ ) ? 1 : 2

    }

    for(i = 0; i < len / 2 + 2; i++) {

    up = up "ਓ";

    dn = dn "Y^"

    }

    printf("ʊ%sʊ\nʼɹ%sɹʻ\nʉ%sʉ\n", up, $0, dn)

    }

    View full-size slide

  31. վྑ൛ͷղઆ
    (1.)

    for(i = 1; i <= length(); i++) {

    len +=

    (substr($0,i,1)~/[\x01-\x7E]/)

    ? 1 : 2

    }
    (2.)

    for(i = 0; i < len / 2 + 2; i++) {

    up = up "ਓ";

    dn = dn "Y^"

    }
    (3.)

    printf("ʊ%sʊ\nʼɹ%sɹʻ\nʉ%sʉ\n",
    up, $0, dn)
    1. จࣈ਺Λऔಘ

    1จࣈͣͭऔΓग़͠ɺจࣈ͕UTF-8Ͱ1όΠτ
    จࣈͰ͋Δ৔߹͸1ɺͦΕҎ֎͸2ͱ͢Δɻ

    UTF-8ͷ1όΠτจࣈ͸ɺ0x01ʙ0x7eؚ͕·
    Ε͍ͯΔ͔Ͳ͏͔Ͱ൑ఆ͢Δɻ
    2. ্෦ʮਓʯɺԼ෦ʮY^ʯΛจࣈ਺ʹԠͯ͡
    ૿΍͢

    ૿΍͢਺͸શ֯ج४Ͱ͋Δ͜ͱʹ஫ҙ
    3. printfͰ੔ܗ

    View full-size slide

  32. ͞ΒͳΔվྑͷಓ
    ➤ ෳ਺ߦରԠ
    ➤ ϧʔϓճ਺ΛݮΒ͢ͳͲͷ࠷దԽ
    ➤ awkΛ࢖Θͳ͍ํ๏
    ➤ etc.
    ➤ ΋ͬͱ͍͍ํ๏͸͋Δ͸ͣͳͷͰɺՋͳͱ͖ʹνϟϨϯδ͠·͠ΐ͏

    View full-size slide

  33. ൪֎ฤ
    _人人人人人人人_

    > 突然のSEGV <

    ‾Y^Y^Y^Y^Y^Y^Y^‾

    View full-size slide

  34. ൪֎ฤ
    ➤ SEGVͰམͪͨɾɾɾ࢓༷?
    $ awk --version

    GNU Awk 4.1.3, API: 1.1 (GNU MPFR 3.1.4, GNU MP 6.1.0)

    <ҎԼུ>

    $ echo ಥવͷSEGV | awk '{print $0~/[\x00-\x7F]/}'

    1

    $ echo ಥવͷSEGV | awk '{print $0~/[\x00-\x80]/}'

    awk: ίϚϯυϥΠϯ:1: க໋తΤϥʔ: ಺෦Τϥʔ: ηάϝϯςʔγϣϯҧ൓

    Aborted (core dumped)

    $

    View full-size slide

  35. 2. SLίϚϯυ

    View full-size slide

  36. LSͷ͋Δ͋Δ࿩
    ➤ lsͱೖΕΑ͏ͱͯ͠

    $ sl -l

    sl: command not found

    $
    ➤ lʮ΋͔ͯ͠͠ʯ

    sʮΘͨͨͪ͠ʯ

    ҎԼུ
    ➤ lsͱؒҧ͑ͯslͬͯೖΕͪΌͬͨʂͱ͍͏͋Δ͋Δ࿩͔Βɺslͱ͍͏δϣʔΫίϚϯ
    υ͕஀ੜͨ͠

    View full-size slide

  37. SLίϚϯυͷ௕͍ྺ࢙
    ➤ 1987೥ɺUNIXχϡʔεάϧʔϓfj.sourceʹॳొ৔(࡞ऀ͸Վ୅࿨ਖ਼͞Μ)
    ➤ 1993೥ɺ๛ాਖ਼࢙͞Μ(ݱࡏɺ।ڭत)͕slίϚϯυΛϦϦʔε

    ͨͩͷδϣʔΫίϚϯυ͔ΒΩʔλΠϓڲਖ਼ίϚϯυʹਐԽ
    ➤ 1990೥୅ޙ൒ʙ LinuxσΟετϦϏϡʔγϣϯʹ౥ࡌ͞ΕΔΑ͏ʹͳΔ
    ➤ 2000೥୅ɺslͷվ଄൛͕ొ৔
    ➤ དྷ೥Ͱ30प೥!

    View full-size slide

  38. SLίϚϯυͷಛ௃
    ➤ Ctrl+C (SIGINT) Λԡͯ͠΋தஅ͠ͳ͍

    ΩʔλΠϓڲਖ਼͕໨త͔ͩΒ
    ➤ lsΑΓ࣮ߦ͕࣌ؒ͸Δ͔ʹ௕͍

    ΩʔλΠϓڲਖ਼͕໨త͔ͩΒ
    ➤ Φϓγϣϯ͕lsʹࣅ͍ͯΔ

    Ωʔt δϣʔΫίϚϯυ͔ͩΒ

    View full-size slide

  39. SLίϚϯυΛγΣϧܳͰ

    View full-size slide

  40. ৚݅
    ➤ ݩωλͷΞεΩʔΞʔτΛϕʔεͱ͢Δ

    o 

    o 

    o ____

    -- |OO|

    _||__| |

    | |

    /-O=O O=O--
    ➤ ंྠ͸ճΒͳ͍
    ➤ ৠؾ͸ݻఆ͔ͭग़ͬͺͳ͠
    ➤ ӈ͔Βࠨ΁ಈ͕͘ɺؿंશମ͸ৗʹදࣔͤ͞Δ
    ➤ Ctrl+C͸༗ޮ (ΩʔλΠϓڲਖ਼͕໨తͰ͸ͳ͍͔Β)

    View full-size slide

  41. γΣϧܳखॱ̍
    AAΛ1ߦʹ
    $ echo -e " o \n o \n o ____\n -- |OO|\n
    _||__| |\n | |\n/-O=O O=O--"

    o 

    o 

    o ____

    -- |OO|

    _||__| |

    | |

    /-O=O O=O--

    $

    View full-size slide

  42. γΣϧܳखॱ̎
    ӈ٧Ί͢Δ
    ؀ڥʹԠͯ͡ tput colsɺBSDܥͳΒ tput coɺBashͳΒecho $COLUMNS Ͱ୺຤ͷ෯͕
    औಘͰ͖Δ
    $ echo $COLUMNS
    120
    awkͷ-vΦϓγϣϯͰγΣϧม਺Λ౉͠ɺεΫϦϓτ಺ͷprintfͰӈ٧Ίͤ͞Δ
    $ echo -e " o \n o \n o ____\n -- |OO|\n
    _||__| |\n | |\n/-O=O O=O--" | awk -v col=$COLUMNS
    '{printf("%" col "s\n", $0)}'

    View full-size slide

  43. γΣϧܳखॱ̏
    ӈ٧Ίͷ෯ΛݮΒ͍͖ͯ͠ɺ׬੒
    for ; do ; doneΛ࢖༻͢Δ
    $ for ((i=$COLUMNS; i>=11; i--)); do clear; echo -e " o
    \n o \n o ____\n -- |OO|\n _||__| |\n |
    |\n/-O=O O=O--" | awk -v col=$i '{printf("%" col "s\n", $0)}';
    sleep 0.06; done

    View full-size slide

  44. ͞ΒͳΔվྑͷಓ
    ➤ ͍͖ͳΓݱΕ͍͖ͯͳΓࢭ·ΔͷͰɺྻंࣄނͷΑ͏ʹݟ͑Δ

    ˞ݩωλ͸૸ΓڈΔ
    ➤ ୺຤ʹΑͬͯ͸ͪΒͭ͘͜ͱ͕͋Δ
    ➤ Ctrl-CΛແޮʹ͢Δʹ͸Ͳ͏ͨ͠Β͍͍?
    ➤ etc.
    ➤ ΋ͬͱ͍͍ํ๏͸͋Δ͸ͣͳͷͰɺՋͳͱ͖ʹνϟϨϯδ͠·͠ΐ͏(2ճ໨)

    View full-size slide

  45. SLίϚϯυ൪֎ฤ(1)
    lsʹࣅͨΦϓγϣϯ΋ଘࡏ͢Δ
    ➤ $ sl -a

    HELP!
    ➤ $ sl -F

    ඈΜͩʂ
    ➤ $ sl -l

    ͪͬ͞ʂ
    ➤ $ sl -c

    C51ͩʂ(Α͘஌Βͳ͍)
    ➤ $ sl -aFlc

    શ෦৐ͤʂ

    View full-size slide

  46. SLίϚϯυ൪֎ฤ(2)
    ➤ slίϚϯυͷιʔείʔυ͸githubʹɻϓϧϦΫͰ͞ΒʹਐԽ
    ➤ վ଄൛͸΋ͬͱ͍͢͝

    ʮSL վ଄ܭըʯhttp://www.izumix.xyz/sl/

    ʢύονద༻ࡁʣhttp://qiita.com/gm_kou/items/2840a6670dc2e733d00a

    ٬ं૿΍ͨ͠Γɺ౿੾ग़͖ͯͨΓɺSL͕ԟ෮ͨ͠Γɺ଎౓͕όϥόϥͩͬͨΓ͍Ζ͍Ζ

    δϣʔΫίϚϯυͷྖҬΛ௒͑ͨ࡞඼
    ➤ Gistʹ͸ژٸԽύον͕͋Δ

    https://gist.github.com/poochin/1423262

    # SL͡Όͳ͍͡ΌΜʂͱ͍͏໺฻ͳಥࠐΈ͸͝ԕྀ͍ͩ͘͞

    View full-size slide

  47. 3.λʔϛφϧը໘Λ

    ͙ͪΌ͙ͪΌʹ

    View full-size slide

  48. λʔϛφϧը໘Λ͙ͪΌ͙ͪΌʹ
    ➤ ANSIΤεέʔϓγʔέϯεΛ࢖͏͜ͱͰɺจࣈʹ৭Λ͚ͭͨΓɺഎܠ৭Λม͑ͨΓ
    ͕Ͱ͖Δ
    ➤ ͜ΕΛར༻ͯ͠ɺը໘Λ͙ͪΌ͙ͪΌʹ͢Δ͜ͱ͕Մೳ

    View full-size slide

  49. എܠ৭Λม͑ΔANSIΤεέʔϓγʔέϯε
    ➤ എܠ৭Λม͑ΔΤεέʔϓγʔέϯε(جຊ8৭)

    ESC[ʻ40ʙ47ʼm

    40: ࠇ, 41: ੺, 42: ྘, 43: ԫ, 44: ੨, 45: Ϛθϯλ, 46: γΞϯ, 47: ന

    ※୺຤ʹΑΓ৭͸ඍົʹҟͳΔ
    ➤ എܠ৭Λม͑ΔΤεέʔϓγʔέϯε(256৭)

    ESC[48;5;ʻ৭൪߸ʼm

    48: ֦ுഎܠ৭; 5: 256৭ΠϯσοΫεΧϥʔ; ৭൪߸: 0ʙ255Λࢦఆ
    ➤ ΤεέʔϓγʔέϯεͷϦηοτίʔυ (͜Ε͕ͳ͍ͱ৭͕Ϧηοτ͞Εͳ͍)

    ESC[0m

    View full-size slide

  50. ➤ echoίϚϯυͰ͸"\e"Λ࢖͏




    ※"\e"Λೝࣝ͠ͳ͍؀ڥ΋͋Δ
    ➤ printfίϚϯυͰ͸"\033"Λ࢖͏
    $ printf "\033[45m%s\033[0m\n" Ϛθϯλ
    ANSIΤεέʔϓγʔέϯε෇͖Ͱදࣔ
    Ϛθϯλ
    $ echo -e “\e[46mγΞϯ\e[0m]
    γΞϯ

    View full-size slide

  51. λʔϛφϧը໘͙ͪΌ͙ͪΌɹ˞௿଎
    $ clear; while :; do c=`expr $RANDOM % 256`; echo -en "\e[48;5;$
    {c}m \e[0m"; done

    View full-size slide

  52. λʔϛφϧը໘͙ͪΌ͙ͪΌɹվྑ൛
    ➤ echo



    ➤ printf




    ※ൈ͚Δʹ͸sleep 500Λফ͔͢Ctrl+CͰ
    $ clear; for color in `od -vAn -tu1 -N $(($COLUMNS*$LINES))
    < /dev/urandom` ; do echo -en "\e[48;5;${color}m \e[0m";
    done; sleep 500
    $ clear; for color in `od -vAn -tu1 -N $(($COLUMNS*$LINES))
    < /dev/urandom` ; do printf "\033[48;5;${color}m \033[0m";
    done; sleep 500

    View full-size slide

  53. ղઆ
    1. 0ʙ255·Ͱͷཚ਺Λऔಘ

    odͱ/dev/urandomΛ࢖༻͢Δ

    $ od -vAn -tu1 -N 1 < /dev/urandom

    15
    2. ୺຤ͷը໘͍ͬͺ͍ʹͳΔΑ͏ʹɺܻ਺ * ߦ਺ճ͚ͩཚ਺Λऔಘ͢Δ

    $ od -vAn -tu1 -N $(($COLUMNS*$LINES)) < /dev/urandom

    241 178 43 211 3 255 29 178 181 247 234 112 157 18 152 29
    3. ΤεέʔϓγʔέϯεͰ৭Λม͑ͤ͞Δ

    $ echo -en “\e[48;5;${color}m \e[0m”

    $ printf “\033[48;5;${color}m \033[0m”
    4. 2.ͰٻΊͨ݁ՌΛforͰճͤ͹׬੒

    View full-size slide

  54. ·ͱΊ
    ➤ ಥવͷࢮδΣωϨʔλʔͱslίϚϯυͳͲΛϫϯϥΠφʔͰ࣮ݱ
    ➤ awkͷ൚༻ੑ͸෠Εͳ͍
    ➤ δϣʔΫίϚϯυΛγΣϧܳͰ࣮ݱͤ͞Δͷ͸ָ͍͠
    ➤ ΋ͬͱ͍͍ํ๏͸͋Δ͸ͣͳͷͰɺՋͳͱ͖ʹνϟϨϯδ͢Δͷ΋Α͍ͱࢥ͍·͢

    View full-size slide