mirror of
https://github.com/olexsmir/dotfiles.git
synced 2026-01-15 16:51:34 +02:00
Add: i3, polybar, rofi, redshift config
This commit is contained in:
parent
68604c9c6a
commit
f8ffdbda2e
15 changed files with 1356 additions and 0 deletions
25
config/polybar/scripts/btc
Executable file
25
config/polybar/scripts/btc
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json,sys,urllib.request,time
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: btc usd,eur,btc nok")
|
||||
sys.exit()
|
||||
|
||||
currencies = sys.argv[1]
|
||||
basecurrency = sys.argv[2]
|
||||
|
||||
currencyurl = "http://freecurrencyrates.com/api/action.php?do=cvals&iso=" + currencies.replace(',','') + "&f=" + basecurrency + "&v=1&s=cbr"
|
||||
f = urllib.request.urlopen(currencyurl)
|
||||
obj = json.loads(f.read())
|
||||
res="";
|
||||
for c in currencies.split(','):
|
||||
res += c.upper() + ":{:,.2f}".format(1/obj[c.upper()]).replace(',',' ')
|
||||
|
||||
# some unicode currency code replacement (optional)
|
||||
res = res.replace("USD", " $")
|
||||
res = res.replace("EUR", " €")
|
||||
res = res.replace("BTC", " ")
|
||||
|
||||
print(res);
|
||||
Loading…
Add table
Add a link
Reference in a new issue