Created
May 12, 2013 20:19
-
-
Save reactorcoremeltdown/5564771 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env bash | |
echo '{ "version": 1 }' | |
echo '[' | |
echo '[]' | |
curler="curl -m 5" | |
ltccourseprev="" | |
while [ true ]; do | |
timeticker=`date +\◔\ %H\:%M\ \ %a\ %d\ %B\ %y` | |
if [[ $(acpitool -b | grep -oe "Charging") != "" ]]; then | |
batteryticker="⚡"`acpitool -b | cut -f 2 -d ','` | |
batterycolor="#00FF00" | |
else | |
batteryticker="∞"`acpitool -b | cut -f 2 -d ','` | |
batterycolor="#FF6600" | |
fi | |
weatherticker="☀ "`$curler -s http://m.gismeteo.ru/ | perl -ne 's#.*temp">([^<]*)°C<.*#\1# and print'` | |
ltccourse=`$curler -s https://btc-e.com/api/2/ltc_rur/ticker | cut -f 3 -d ',' | cut -f 2 -d ':' | sed 's/\./,/'` | |
if [[ $ltccourse -gt $ltccourseprev ]]; then | |
litecointicker="Ƚ "$ltccourse" RUR ⇧" | |
ltccolor="#55D400" | |
ltccourseprev=$ltccourse | |
else | |
litecointicker="Ƚ "$ltccourse" RUR ⇩" | |
ltccolor="FF0000" | |
ltccourseprev=$ltccourse | |
fi | |
if [[ $($curler -s "http://v4v6.ipv6-test.com/api/myip.php" | grep ':') != "" ]]; then | |
ipv6ticker="✔ ipv6" | |
ipv6color="#0055D4" | |
elif [[ $($curler -s "http://v4v6.ipv6-test.com/api/myip.php" | grep '.') != "" ]]; then | |
ipv6ticker="✔ ipv4" | |
ipv6color="#FFCC00" | |
else | |
ipv6ticker="✘ no link" | |
ipv6color="#AA0000" | |
fi | |
echo -e ",[ | |
{ \"full_text\": \"❰\", \"color\": \"#505050\", \"separator\": false }, | |
{ \"name\": \"litecointicker\", \"full_text\": \"$litecointicker\", \"color\": \"$ltccolor\", \"separator\": false }, | |
{ \"full_text\": \"❰\", \"color\": \"#505050\", \"separator\": false }, | |
{ \"name\": \"weatherticker\", \"full_text\": \"$weatherticker\", \"color\": \"#FFCC00\", \"separator\": false }, | |
{ \"full_text\": \"❰\", \"color\": \"#505050\", \"separator\": false }, | |
{ \"name\": \"ipv6ticker\", \"full_text\": \"$ipv6ticker\", \"color\": \"$ipv6color\", \"separator\": false }, | |
{ \"full_text\": \"❰\", \"color\": \"#505050\", \"separator\": false }, | |
{ \"name\": \"batteryticker\", \"full_text\": \"$batteryticker\", \"color\": \"$batterycolor\", \"separator\": false }, | |
{ \"full_text\": \"❰\", \"color\": \"#505050\", \"separator\": false }, | |
{ \"name\": \"timeticker\", \"full_text\": \"$timeticker\", \"color\": \"#8080FF\", \"separator\": false }, | |
{ \"full_text\": \"❰\", \"color\": \"#505050\", \"separator\": false } | |
]" | |
sleep 30 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment