• # Bitcoin ticker dans le prompt du shell

    Posté par (site web personnel) . En réponse au journal Conséquences sociales des cryptomonnaies - 2. Évalué à 5. Dernière modification le 13 décembre 2017 à 08:37.

    Je ne possède aucun bitcoin mais pour taquiner mes collègues, riches de 0.2 à 2.4 bitcoins, j'ai mis un bitcoin ticker dans le prompt du shell. C'est bien, faisez tous comme moi!

    ➜ jscl git:(explore/react) ✗
    bitcoin_ticker_value()
    {
     node -e "jsonticker=$(curl -s https://blockchain.info/ticker);console.log(jsonticker['EUR']['15m']);"
    }
    bitcoin_ticker_info()
    {
     printf '[EUR %s]' "$(bitcoin_ticker_value)"
    }
    bitcoin_ticker_install()
    {
     PROMPT='$(bitcoin_ticker_info) '"${PROMPT}"
    }
    

    Et le voilà en action (ZSH):

    ➜ jscl git:(explore/react) ✗ bitcoin_ticker_install
    [EUR 14005.31] ➜ jscl git:(explore/react) ✗ 
    [EUR 14005.31] ➜ jscl git:(explore/react) ✗ git status 
    On branch explore/react
    Your branch is ahead of 'origin/explore/react' by 3 commits.
     (use "git push" to publish your local commits)
    Changes not staged for commit:
     (use "git add <file>..." to update what will be committed)
     (use "git checkout -- <file>..." to discard changes in working directory)
     modified: react.html
     modified: react/example-2.lisp
     modified: react/react.lisp
    Untracked files:
     (use "git add <file>..." to include in what will be committed)
     FFI.md
     HACKING.pdf
     HACKING.tex
     babel-example.js
     lfreact/
     react/example-1.js
     react/example-2.js
    no changes added to commit (use "git add" and/or "git commit -a")
    [EUR 13969.59] ➜ jscl git:(explore/react) ✗ git add react.html react/react.lisp
    [EUR 14530.99] ➜ jscl git:(explore/react) ✗ git commit --fixup=0f6b7b5
    [explore/react eaf1779] fixup! Work on the definition of CREATE-CLASS
     2 files changed, 27 insertions(+), 20 deletions(-)
    [EUR 13969.59] ➜ jscl git:(explore/react) ✗ 
    [EUR 13855.45] ➜ jscl git:(explore/react) ✗ 
    

    L'inconvénient est que si blockchain.info commence à retourner des exploits... etc.