V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Coder89757
V2EX  ›  科技

遇事不决?🌝试试这个有意思的抛硬币 jio 本

  •  3
     
  •   Coder89757 · 2019-03-19 19:51:19 +08:00 · 1932 次点击
    这是一个创建于 1836 天前的主题,其中的信息可能已经有所发展或是发生改变。

    之前摸鱼写的 jio 本🌝,可以放在 ~/.zshrc 文件的末尾,注入终端的上下文

    预览效果如下: coin_bash_preview

    灵感来自Animating URLs with Javascript and Emojis,祝各位看官玩得开心😊

    # 抛硬币脚本
    # Author: Lucien-X
    # LastModified: 2019-02-22
    
    coin() {
      # Define backspace char
      local BACKSPACE='\b\b'
      # Loop animation for about 1s
      local i="0"
      while [ $i -lt 24 ]
      do
        for COIN in '🌝' '🌖' '🌗' '🌘' '🌚' '🌒' '🌓' '🌔'
        do
          echo -en "$BACKSPACE$COIN"
          sleep 0.0417; # Insure 24 fps (1/24 ≈ 0.0417)
          i=$[$i+1];
        done
      done
      # Roll the dice eventually
      echo -en $BACKSPACE
      if [[ $[ $RANDOM % 2 ] == 0 ]] then
        echo -en "🌝"
      else
        echo -en "🌚"
      fi
    }
    
    第 1 条附言  ·  2019-03-27 11:36:57 +08:00
    7 条回复    2019-03-25 22:50:06 +08:00
    sologgfun
        1
    sologgfun  
       2019-03-19 19:53:46 +08:00
    蛮搞笑的
    gstqc
        2
    gstqc  
       2019-03-19 19:55:48 +08:00   ❤️ 2
    https://pbs.twimg.com/media/DMZNbAvWkAE1Snp.jpg

    把这个写成脚本,困的时候跑一下,精神百倍
    Coder89757
        3
    Coder89757  
    OP
       2019-03-19 19:57:56 +08:00
    @gstqc 俄罗斯轮盘赌? hhhh
    kinghui
        4
    kinghui  
       2019-03-20 11:42:36 +08:00   ❤️ 1
    Coder89757
        5
    Coder89757  
    OP
       2019-03-20 14:40:19 +08:00
    @kinghui 哈哈,老铁可以的,够无聊,我喜欢
    cgsv
        6
    cgsv  
       2019-03-20 15:35:40 +08:00   ❤️ 1
    laozhoubuluo
        7
    laozhoubuluo  
       2019-03-25 22:50:06 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3271 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 12:04 · PVG 20:04 · LAX 05:04 · JFK 08:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.