Python currency converter
This commit is contained in:
@@ -32,12 +32,10 @@ whi "whereis"
|
|||||||
|
|
||||||
# nvt "nvidia-settings --assign CurrentMetaMode='DVI-I-1: nvidia-auto-select +0+0 {ForceCompositionPipeline=On}, HDMI-0: nvidia-auto-select +3840+0 {ForceCompositionPipeline=On}'"
|
# nvt "nvidia-settings --assign CurrentMetaMode='DVI-I-1: nvidia-auto-select +0+0 {ForceCompositionPipeline=On}, HDMI-0: nvidia-auto-select +3840+0 {ForceCompositionPipeline=On}'"
|
||||||
|
|
||||||
{{ if eq .chezmoi.hostname "nzxt" }}
|
|
||||||
xra "xrandr --auto"
|
xra "xrandr --auto"
|
||||||
xrs "xrandr --auto && xrandr --output HDMI-0 --right-of DVI-I-1"
|
xrs "xrandr --auto && xrandr --output HDMI-0 --right-of DVI-I-1"
|
||||||
xrn "xrandr --output HDMI-0 --rotate normal && grep wallpaper ~/.cache/wal/colors.sh | cut -d\' -f2 | xargs wal -i > /dev/null"
|
xrn "xrandr --output HDMI-0 --rotate normal && grep wallpaper ~/.cache/wal/colors.sh | cut -d\' -f2 | xargs wal -i > /dev/null"
|
||||||
xrr "xrandr --output HDMI-0 --rotate right && grep wallpaper ~/.cache/wal/colors.sh | cut -d\' -f2 | xargs wal -i > /dev/null"
|
xrr "xrandr --output HDMI-0 --rotate right && grep wallpaper ~/.cache/wal/colors.sh | cut -d\' -f2 | xargs wal -i > /dev/null"
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if eq .chezmoi.hostname "x1-carbon" }}
|
{{ if eq .chezmoi.hostname "x1-carbon" }}
|
||||||
xro "xrandr --output HDMI2 --off"
|
xro "xrandr --output HDMI2 --off"
|
||||||
@@ -358,9 +356,9 @@ am "antimicro"
|
|||||||
# task [[[ #
|
# task [[[ #
|
||||||
|
|
||||||
a "task"
|
a "task"
|
||||||
aa "task add"
|
aa "task add proj:anp"
|
||||||
|
aan "task add"
|
||||||
aal "task add proj:lnx"
|
aal "task add proj:lnx"
|
||||||
aan "task add proj:anp"
|
|
||||||
aap "task add proj:"
|
aap "task add proj:"
|
||||||
aas "task add proj:sch"
|
aas "task add proj:sch"
|
||||||
# aam "task add proj:ms"
|
# aam "task add proj:ms"
|
||||||
@@ -417,6 +415,8 @@ but "buku -zu --tag"
|
|||||||
bw "buku --immutable 1 -w -1"
|
bw "buku --immutable 1 -w -1"
|
||||||
|
|
||||||
# ]]] buku #
|
# ]]] buku #
|
||||||
|
ca "currency CAD USD"
|
||||||
|
us "currency USD CAD"
|
||||||
cc "calcurse"
|
cc "calcurse"
|
||||||
ccc "calcurse -D ~/.calcurse/alt-cals/class"
|
ccc "calcurse -D ~/.calcurse/alt-cals/class"
|
||||||
cci "calcurse -i"
|
cci "calcurse -i"
|
||||||
@@ -611,7 +611,7 @@ wrw "watson report -Gc"
|
|||||||
|
|
||||||
# timetrace [[[ #
|
# timetrace [[[ #
|
||||||
|
|
||||||
tt "timetrace"
|
ttr "timetrace"
|
||||||
tta "timetrace start"
|
tta "timetrace start"
|
||||||
ttaa "timetrace start a3@300"
|
ttaa "timetrace start a3@300"
|
||||||
tte "timetrace edit record latest"
|
tte "timetrace edit record latest"
|
||||||
@@ -1057,6 +1057,8 @@ ssc "mosh mokkar@teach.cs.utoronto.ca"
|
|||||||
ttlo "timetrace start look@job"
|
ttlo "timetrace start look@job"
|
||||||
ttle "timetrace start leetcode@job"
|
ttle "timetrace start leetcode@job"
|
||||||
|
|
||||||
|
ts "npx tsc"
|
||||||
|
|
||||||
# ]]] work #
|
# ]]] work #
|
||||||
|
|
||||||
# red-hat [[[ #
|
# red-hat [[[ #
|
||||||
|
|||||||
@@ -280,6 +280,7 @@ el ~/coding/eliza
|
|||||||
an ~/coding/ai-nft-proj/
|
an ~/coding/ai-nft-proj/
|
||||||
anb ~/coding/ai-nft-proj/backend
|
anb ~/coding/ai-nft-proj/backend
|
||||||
anf ~/coding/ai-nft-proj/frontend
|
anf ~/coding/ai-nft-proj/frontend
|
||||||
|
tt ~/coding/try-eliza-twitter-client
|
||||||
|
|
||||||
# ]]] sch #
|
# ]]] sch #
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ abbr bq "benq-brightness"
|
|||||||
abbr bn "discord-burner"
|
abbr bn "discord-burner"
|
||||||
abbr bun "backup nzxt"
|
abbr bun "backup nzxt"
|
||||||
abbr bupp "backup-phone-pics"
|
abbr bupp "backup-phone-pics"
|
||||||
abbr ca "cad-to-us"
|
#abbr ca "cad-to-us"
|
||||||
abbr cccs "sync-alt-cal class"
|
abbr cccs "sync-alt-cal class"
|
||||||
abbr cl "clip"
|
abbr cl "clip"
|
||||||
abbr cli "clip-ipad"
|
abbr cli "clip-ipad"
|
||||||
@@ -296,7 +296,7 @@ abbr tan2 "tmux-attach nft-2"
|
|||||||
abbr tao "tmux-attach obs"
|
abbr tao "tmux-attach obs"
|
||||||
abbr thes "thesaurus"
|
abbr thes "thesaurus"
|
||||||
# abbr usc "us-to-cad"
|
# abbr usc "us-to-cad"
|
||||||
abbr us "us-to-cad"
|
#abbr us "us-to-cad"
|
||||||
abbr ut "unix-timestamp"
|
abbr ut "unix-timestamp"
|
||||||
abbr uzr "unzip-rm"
|
abbr uzr "unzip-rm"
|
||||||
abbr vsnp "vim-snippet"
|
abbr vsnp "vim-snippet"
|
||||||
|
|||||||
@@ -83,10 +83,10 @@ interval=5
|
|||||||
#command=/home/kevin/.config/i3blocks/scripts/dexscreener-fdv solana a8nphpcjqtqhdquk35uj9hy2ysgxfkczgunwvkd3k7vc
|
#command=/home/kevin/.config/i3blocks/scripts/dexscreener-fdv solana a8nphpcjqtqhdquk35uj9hy2ysgxfkczgunwvkd3k7vc
|
||||||
#interval=30
|
#interval=30
|
||||||
|
|
||||||
[dexscreener]
|
#[dexscreener]
|
||||||
label=ANIME
|
#label=ANIME
|
||||||
command=/home/kevin/.config/i3blocks/scripts/dexscreener arbitrum 0xbbf3209130df7d19356d72eb8a193e2d9ec5c234
|
#command=/home/kevin/.config/i3blocks/scripts/dexscreener arbitrum 0xbbf3209130df7d19356d72eb8a193e2d9ec5c234
|
||||||
interval=30
|
#interval=30
|
||||||
|
|
||||||
#[dexscreener]
|
#[dexscreener]
|
||||||
#label=TRUMP
|
#label=TRUMP
|
||||||
|
|||||||
29
scripts/executable_currency
Normal file
29
scripts/executable_currency
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import requests
|
||||||
|
|
||||||
|
def convert_currency(amount, from_currency, to_currency):
|
||||||
|
url = f"https://api.frankfurter.app/latest?amount={amount}&from={from_currency}&to={to_currency}"
|
||||||
|
response = requests.get(url)
|
||||||
|
if response.status_code == 200:
|
||||||
|
data = response.json()
|
||||||
|
converted_amount = data['rates'][to_currency]
|
||||||
|
print(f"{amount} {from_currency} = {converted_amount} {to_currency}")
|
||||||
|
else:
|
||||||
|
print("Error: Unable to fetch exchange rates.")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) != 4:
|
||||||
|
print("Usage: currency_converter.py <amount> <from_currency> <to_currency>")
|
||||||
|
print("Example: currency_converter.py 100 CAD USD")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
amount = float(sys.argv[3])
|
||||||
|
from_currency = sys.argv[1].upper()
|
||||||
|
to_currency = sys.argv[2].upper()
|
||||||
|
|
||||||
|
convert_currency(amount, from_currency, to_currency)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user