Last active
July 31, 2018 05:11
-
-
Save hoducha/210d9811e196619f1a7a59321a0498a1 to your computer and use it in GitHub Desktop.
A bitbar plugin that displays the current cryptocurrency prices in the menu bar
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
#!/bin/bash | |
# <bitbar.title>Cryptocurrency Prices</bitbar.title> | |
# <bitbar.version>v1.0</bitbar.version> | |
# <bitbar.author>Ha Ho</bitbar.author> | |
# <bitbar.author.github>hoducha</bitbar.author.github> | |
# <bitbar.desc>Displays cryptocurrency prices from https://coinmarketcap.com</bitbar.desc> | |
# <bitbar.image>https://www.screencast.com/t/BUREirqk</bitbar.image> | |
# <bitbar.dependencies>bash, python</bitbar.dependencies> | |
# | |
# Based on Cryptocurrency Prices plugin by viiraj (github.com/viiraj). | |
# bitcoin_icon='iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAQAAABLCVATAAAACXBIWXMAABYlAAAWJQFJUiTwAAABY0lEQVRIx2P4z0AdyEBzg1DAdIYfQJgCZHmCWdsYMAFRBs0BC2UAWT5g1p6hbZAggwIcrgALVQNZSWDWAQY24g3qwRtJ/xgeMqxkCGJgotQgGLzAoEUdg/4zvGQQIxzYLAyODF/gQv0MlgwWDK4MOQxbgV5DKG0nLtZ2wIUykII2EMmoU8QZtAWrQQwMB+HiDygzaDNc/CQlBskwfIKLN5JrkAxDFsMTuOh9BiFSDXoHDI2HDB9RlJ1kECc2r20hkI5OMXhQxyAQzCTNoDJgaAgAvaLLEMkwn+EbkuLvDBLkR78yUoD/Z0gn3yAGhnwk5V2UGBRGLYNmICkvIGzQLqwG8TA0oJQAVvgMymcoYehg+AUXWgoM0kygWC/DbpQ4+89wjYERt0FiRNeNX4GlFJ505EykMacZDPGn7HwCBnxiOMcwjcGJcOEvzqADh2vBQk1AVhaYdZCBc7TKpqJBA9ZiAwDMH49EXcmY2QAAAABJRU5ErkJggg==' | |
# ltc_icon='iVBORw0K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xYXShM0ZdiMYoCyUxM4lGwdHFJFIRo1E61kmRUijSPkuhfX33z/tAE8/i5st93/nu+c7Jg+ArJAA4vbwhkERG3l9KUUmBL+0fff9fh/ruO3fV55DSdVSAFUQj00XieQomXthQkdCE2eK3fXYdEvw6kDJSrmuTGsA7PtrF434d1wsGn1ZMvIkYF3tXccYCCMGtjuQXkFXXYlIzdwJTegKnPh9GRecGY2KQCd4ngaz7AelnS3S0e3hJQ3XmZHf+FicvgJCihGM//FjV9CvgNAE3tqYKfT3FT6lMsi0QmHK3+VBVV+NFWpcE+K4UcI+BcWeZNfm7eeGKxexiN6IE1KNyczTXc/mnqmz+ZdnU1J8DAwPEXWfl+IexykT02DuSjJoYbCsjWo0wSndWzsz5EJNRBLH+719vht6jRGI11PWM4fUSx3EMCJS4U6dgrzJya9zKppzipZRT6EUz45fHNNzEMFwPR5c3/mL49VvWnTsVUspdjLH+YDD4WtVQQSoFUA1yoUqFngdrSSbdATEuRxrRnuEkXWyYpq+yogJyzvF808IBYTisJizw3Ct9bvYawChIf+vsIta+7v/Z7HPNZGw/8HhOCyGOqp7hBa56LRyWrcllmnbx9kHJ6WIBxV2V7wQ4ENGgyhWGlbS98XiN2nVLOpuNbw6F/pkn/9FbDWxRCT7lxvWmmofAKQaBlVzjHDn01uURtZE8qWQ9icena2trm1s3NO9/NTh4cP3joYLHWHSGe/VWzukxOVc4z6H0Cd2bUIOhy0PuC8oYYBgGp5RGp9PTMTo5mQY204EU9ajU00A0GKBDf9+8t6XpWmRzI/vmwVcjlZVSqrQSRi6X+9nj8RzNZDJdLc+ieYD1epCIPYp0bNcUgqph8Me2tlk3ie/J8/XIyMgmQsg+27azOiGz1Qj1jRcK5hyEzdS274dCobhLnFfsHt/DVRCLxbR8Pr9TJb1a/UlLERD9M5b1sL29Pa+I4lv/F096fWxsMVzLAAAAAElFTkSuQmCC' | |
eth_price=$(curl -s -k "https://api.coinmarketcap.com/v1/ticker/ethereum/" | python -c "import sys, json; price = json.load(sys.stdin)[0]['price_usd']; price = round(float(price), 2) if price is not None else None; print(price)") | |
neo_price=$(curl -s -k "https://api.coinmarketcap.com/v1/ticker/neo/" | python -c "import sys, json; price = json.load(sys.stdin)[0]['price_usd']; price = round(float(price), 2) if price is not None else None; print(price)") | |
coss_price=$(curl -s -k "https://api.coinmarketcap.com/v1/ticker/coss/" | python -c "import sys, json; price = json.load(sys.stdin)[0]['price_usd']; price = round(float(price), 2) if price is not None else None; print(price)") | |
echo "$eth_price | templateImage=$eth_icon" | |
echo "$neo_price | templateImage=$neo_icon" | |
echo "$coss_price | templateImage=$coss_icon" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment