From 1afe9d05a4ad9ac399f6afdbeaf4a3238f27f179 Mon Sep 17 00:00:00 2001 From: Kevin Mok Date: Thu, 30 Mar 2023 08:33:32 -0400 Subject: [PATCH] Kraken ticker i3block --- aliases/key_aliases.tmpl | 48 ++++++------------- aliases/key_dirs.tmpl | 39 +++++++-------- aliases/key_files.tmpl | 5 +- dot_config/fish/config.fish.tmpl | 11 ++++- dot_config/fish/functions/video-to-gif.fish | 4 ++ dot_config/fish/functions/wget-name.fish | 3 ++ dot_config/i3/config.tmpl | 3 +- dot_config/i3blocks/i3blocks.conf.tmpl | 36 ++++++++++---- dot_config/i3blocks/scripts/executable_kraken | 5 ++ dot_config/mpv/input.conf | 12 ++--- .../spotify/Users/polarbier-user/prefs.tmpl | 16 ------- dot_gitconfig.tmpl | 2 +- dot_vimrc.tmpl | 2 - scripts/executable_kraken | 8 ++++ scripts/executable_ticker | 9 ++-- 15 files changed, 110 insertions(+), 93 deletions(-) create mode 100644 dot_config/fish/functions/video-to-gif.fish create mode 100644 dot_config/fish/functions/wget-name.fish create mode 100755 dot_config/i3blocks/scripts/executable_kraken delete mode 100644 dot_config/spotify/Users/polarbier-user/prefs.tmpl create mode 100755 scripts/executable_kraken diff --git a/aliases/key_aliases.tmpl b/aliases/key_aliases.tmpl index f5509e8..6023f5b 100644 --- a/aliases/key_aliases.tmpl +++ b/aliases/key_aliases.tmpl @@ -118,6 +118,7 @@ sfpx "sftp -rP 8022 $PIXEL_IP" rspx "rsync --ignore-existing -Ptre 'ssh -p 8022' $PIXEL_IP:" # ]]] pixel # +ssl "mosh --ssh='ssh -p 399' kevin@$LAPTOP_IP" # vultr ssa "mosh atxadmin@45.32.87.10" @@ -198,8 +199,8 @@ uzl "unzip -l" # power options [[[ # s "systemctl suspend" -sl "i3lock-fancy && systemctl suspend" -so "xset dpms force off" +# sl "i3lock-fancy && systemctl suspend" +# so "xset dpms force off" xx "exit" sof "xset dpms force off" son "xset s off -dpms" @@ -304,7 +305,8 @@ spipi "sudo pip install" # internet [[[ # -pg "ping -c 2 -W 1 8.8.8.8" +pg2 "ping -c 2 -W 1 8.8.8.8" +pgt "ping -c 50 -W 1 8.8.8.8" wpg "watch ping -c 2 -W 1 8.8.8.8" pgc "ping 8.8.8.8" dh "sudo dhcpcd" @@ -378,7 +380,7 @@ ay "task sync" # buku [[[ # # b "buku" -bd "buku -a '" +# bd "buku -a '" bdb "sqlitebrowser ~/.local/share/buku/bookmarks.db &" bh "buku -h | bat" bi "buku --immutable 1 -zu" @@ -442,6 +444,7 @@ mra "man ranger" n "nvim" nl "nload devices wlp4s0 -u M" nm "nomacs ." +nmd "nomacs ." np "nvim --" ndu "ncdu" p3 "python3" @@ -465,7 +468,7 @@ sn "sudo nvim" sqlb "sqlitebrowser" # ss "mosh" stp "termdown" -h "termdown" +# h "termdown" # sw "swex" # t "tmux"#[[[ # ta "tmux a -t" @@ -511,7 +514,7 @@ trx "tar xvzf" # pass [[[ # # p "pass" -pc "pass -c" +# pc "pass -c" pe "pass edit" pi "pass insert -m" pg "pass generate -c" @@ -581,8 +584,8 @@ tte "timetrace edit record latest" # ttc "timetrace create" ttc "timetrace create project" ttp "timetrace create project" +ttl "timetrace list records today" ttlp "timetrace list projects" -ttlr "timetrace list records today" ttr "timetrace report" tts "timetrace stop" ttt "timetrace status" @@ -942,7 +945,7 @@ ssr "mosh 161.35.107.30" # ]]] rarity surf # stb "source ~/.venv/twitter-bot/bin/activate.fish" -pr "python retweet.py" +# pr "python retweet.py" prg "python retweet.py --giveaway" prm "python retweet.py --mentions | bat" @@ -1008,30 +1011,7 @@ umip "fusermount -u /mnt/ipad" gpa "column -ts',' ~/Documents/gpa.md" ssc "mosh mokkar@teach.cs.utoronto.ca" -# 301 [[[ # - -spc "source ~/.venv/price-calc/bin/activate.fish" -scv "source ~/.venv/covid-monitor/bin/activate.fish" -fr "flask run" -pmd "python manage.py db" -pmdm "python manage.py db migrate" -pmdu "python manage.py db upgrade" -# pt "pytest --cov" - -# ]]] 301 # - -# 458 [[[ # - -ssm "ssh -p 2222 mininet@localhost" -rs "rsync *.c *.h -Pave 'ssh -p 2222' mininet@127.0.0.1:~/pa1/router/" -rsw "rsync -PavIe 'ssh -p 2222' mininet@127.0.0.1:~/pa1/router/sr-.pcap ." -trm "tar czf pa1.tar.gz *" -# trm "make compress" -trxm "tar xf pa1.tar.gz" -cpt "cp pa1.tar.gz /home/kevin/school/458/a1/router" -xcd "date | xclip -selection clipboard" - -# ]]] 458 # +zs "zathura --fork syllabus.pdf" # ]]] school # @@ -1200,7 +1180,9 @@ tet "ticker (xclip -o) | xclip -selection clipboard" eip "curl ifconfig.me" fdb "firefox -P discord-" sip "curl ifconfig.me" -vpc "nordvpn connect && curl ifconfig.me" +# vpc "nordvpn connect && curl ifconfig.me" +vpc "nordvpn connect" vpd "nordvpn disconnect" +vpt "nordvpn status" # ]]] vpn # diff --git a/aliases/key_dirs.tmpl b/aliases/key_dirs.tmpl index 2b02727..fc7ba95 100644 --- a/aliases/key_dirs.tmpl +++ b/aliases/key_dirs.tmpl @@ -71,7 +71,7 @@ hv ~/Documents/hevin hvs ~/Documents/hevin/shopping j ~/Documents/journal jt ~/Documents/journal/todo -lh ~/Documents/listening-history +# lh ~/Documents/listening-history mmd ~/coding/move-mouse-with-head mh ~/coding/mf-site/layouts ms ~/coding/mf-site @@ -83,6 +83,7 @@ pn ~/coding/red-discord-bot rsf ~/coding/rarity-surf/frontend rsc ~/coding/rarity-surf/backend/rarity_check/project/management/commands # rsm ~/coding/rarity-surf/backend/rarity_check/project/migrations +sl ~/Documents/sleep sv ~/coding/spotify-lib-vis/src svg ~/coding/spotify-lib-vis/src/graphs/static/graphs/scripts swd ~/coding/swex @@ -156,6 +157,8 @@ sdv ~/Documents/stardew-valley-aha wo ~/Documents/workout-logs/7 +dap /mnt/linux-files-2/Pictures/ipad + # ]]] gaming # # sch [[[ # @@ -163,26 +166,24 @@ wo ~/Documents/workout-logs/7 sc ~/school lt ~/school/latex-notes -3 ~/school/318 -3a ~/school/318/a3 - -# 458 [[[ # - -4 ~/school/458 -4a ~/school/458/a1/router -4a2 ~/school/458/a1-2/router -4a3 ~/school/458/a1-3/router -4as ~/school/458/a1-sol/router -4i ~/school/458/a1-instr -4t ~/school/458/a1-tar/PA1 - -4p ~/school/latex-notes/458/ps1 -4s ~/school/458/slides - -# ]]] 458 # - ltc ~/coding/leetcode +sl ~/ +es ~/coding/estuary +esw ~/coding/estuary-www + +4 ~/school/494 +4d ~/school/494/design +4dp ~/school/494/design/provotu +4p ~/school/494/papers +vt ~/coding/dao-voting +ovn ~/coding/dao-voting/anonymousvoting/contracts +pv ~/coding/dao-voting/provotum-v2 +bd ~/coding/dao-voting/besu-deploy + +h ~/school/phy +pc ~/school/pcl + # ]]] sch # # pey [[[ # diff --git a/aliases/key_files.tmpl b/aliases/key_files.tmpl index ccab889..91931ce 100644 --- a/aliases/key_files.tmpl +++ b/aliases/key_files.tmpl @@ -45,7 +45,7 @@ hh ~/.habitctl/habits hlg ~/coding/spotify-lib-vis/src/api/management/commands/update-history.log id ~/Documents/journal/todo/ideas.md ig ./.gitignore -jt ~/Documents/journal/todo/22/8.md +jt ~/Documents/journal/todo/23/3.md k ~/linux-config/dot_config/kitty/kitty.conf lh ~/Documents/listening-history/polarbier.csv mc ~/coding/mf-site/assets/sass/main.scss @@ -54,6 +54,7 @@ ne ~/linux-config/configs/neofetch/config.conf re README.md rda ~/Documents/red-discord-bot/repos/gobcog-kevin/adventure/adventure.py rdc ~/Documents/red-discord-bot/commands-freq.md +sl ~/Documents/sleep/sleep.md td todo.md tg ~/.config/watson/tags_cache tt txt/todo.md @@ -68,7 +69,7 @@ wt ~/.config/watson/state.tmp # sch [[[ # -sr ~/school/458/a1/router/sr_router.c +4d ~/school/494/design/acanet-voting-design.md # ]]] sch # diff --git a/dot_config/fish/config.fish.tmpl b/dot_config/fish/config.fish.tmpl index ca04757..3a6ecf8 100755 --- a/dot_config/fish/config.fish.tmpl +++ b/dot_config/fish/config.fish.tmpl @@ -27,7 +27,7 @@ abbr hum "cd $mfs_dir && hugo serve -D --disableFastRender" # system [[[ set -x HASTE_SERVER https://pste.gq {{ if eq .chezmoi.hostname "nzxt" }} -set -x CALCURSE_CALDAV_PASSWORD (pass show technology/linux/baikal | head -n1) +# set -x CALCURSE_CALDAV_PASSWORD (pass show technology/linux/baikal | head -n1) {{ end }} set -x LD_LIBRARY_PATH $LD_LIBRARY_PATH /usr/local/lib /usr/local/lib64 set -x GOPATH ~/go @@ -70,12 +70,15 @@ set -xU XSET_DELAY 200 xset r rate $XSET_DELAY $XSET_RATE {{ end }}#]]] +# [[[ universal var's # + set -xU BROWSER "firefox" # set -U BROWSER "chromium" set -xU FZF_DEFAULT_COMMAND "find ." -set -x PHONE_IP "192.168.0.12" +set -x LAPTOP_IP "192.168.0.19" +set -x PHONE_IP "192.168.0.13" set -x PIXEL_IP "192.168.0.18" set -x WORK_LAPTOP_IP "kmok@192.168.0.11" @@ -92,6 +95,8 @@ set -xU LOCAL_KOGITO_SERVICE_PORT "32000" set -x FLASK_DEBUG 1 set -x DB_NAME "covid_monitor" +set -x FULLNODE_API_INFO wss://api.chain.love + # ]]] universal var's # # fish-specific [[[ # @@ -182,6 +187,7 @@ abbr ff "fzf-cd" # abbr fr "fzf-ranger" abbr fv "fzf-vim" abbr fvft "find-vim-filetype" +abbr gif "video-to-gif" # git [[[ # abbr gcamp "git-amend-push" @@ -239,6 +245,7 @@ abbr wga "wget-all" abbr wag "watson-add-game" abbr waf "watson-add-game fortnite" abbr wap "watson-add-game pokemon-go" +abbr wgn "wget-name" abbr xya "export-pkgs" # school [[[ # diff --git a/dot_config/fish/functions/video-to-gif.fish b/dot_config/fish/functions/video-to-gif.fish new file mode 100644 index 0000000..321d886 --- /dev/null +++ b/dot_config/fish/functions/video-to-gif.fish @@ -0,0 +1,4 @@ +function video-to-gif + # ffmpeg -i $argv[1] -filter_complex "[0:v]setpts=0.5*PTS,fps=24,split [a][b];[a] palettegen [p];[b][p] paletteuse" $argv[2] + ffmpeg -i $argv[1] -filter_complex "[0:v]fps=24,split [a][b];[a] palettegen [p];[b][p] paletteuse" $argv[2] +end \ No newline at end of file diff --git a/dot_config/fish/functions/wget-name.fish b/dot_config/fish/functions/wget-name.fish new file mode 100644 index 0000000..f53fa5b --- /dev/null +++ b/dot_config/fish/functions/wget-name.fish @@ -0,0 +1,3 @@ +function wget-name + wget $argv[1] -O $argv[2] +end \ No newline at end of file diff --git a/dot_config/i3/config.tmpl b/dot_config/i3/config.tmpl index 3608850..6913a6b 100755 --- a/dot_config/i3/config.tmpl +++ b/dot_config/i3/config.tmpl @@ -463,7 +463,8 @@ set $ws11 "11 " workspace $ws11 output $secondary # bindsym $mod+F11 workspace $ws11; exec $term -e htop -s PERCENT_CPU bindsym $mod+F11 workspace $ws11; exec $term -e htop -s PERCENT_MEM -bindsym Mod4+$mod+F11 workspace $ws11; exec $term -e fish -c 'tmux-attach obs' +# bindsym Mod4+$mod+F11 workspace $ws11; exec $term -e fish -c 'tmux-attach backup' +bindsym Control+Shift+F11 workspace $ws11; exec $term -e fish -c 'tmux-attach backup' bindsym Mod4+t workspace $ws11; exec nordvpn connect && transmission-gtk # bindsym $mod+F11 workspace $ws11; exec $term -e gotop -m # bindsym Mod4+a workspace $ws11; exec antimicro diff --git a/dot_config/i3blocks/i3blocks.conf.tmpl b/dot_config/i3blocks/i3blocks.conf.tmpl index a006c17..108c7d3 100755 --- a/dot_config/i3blocks/i3blocks.conf.tmpl +++ b/dot_config/i3blocks/i3blocks.conf.tmpl @@ -18,20 +18,40 @@ color=#cbe4ff {{ if eq .chezmoi.hostname "nzxt" }} # [ticker] -# label=BTC  -# TICKER=BTC-USD +# label=SOL  +# TICKER=SOL-USD +# interval=30 + +[kraken] +label=ARB +TICKER=ARBUSD +interval=30 + +# [ticker] +# label=ETH +# TICKER=ETH-USD # interval=30 -[ticker] -label=SOL  -TICKER=SOL-USD +[kraken] +label=ETH +TICKER=ETHUSDC interval=30 -[ticker] -label=ETH  -TICKER=ETH-USD +[kraken] +label=BLUR +TICKER=BLURUSD interval=30 +# [ticker] +# label=SPY  +# TICKER=SPY +# interval=30 + +# [ticker] +# label=BTC  +# TICKER=BTC-USD +# interval=30 + # [ticker] # label=DAQ  # TICKER=^IXIC diff --git a/dot_config/i3blocks/scripts/executable_kraken b/dot_config/i3blocks/scripts/executable_kraken new file mode 100755 index 0000000..c0499cb --- /dev/null +++ b/dot_config/i3blocks/scripts/executable_kraken @@ -0,0 +1,5 @@ +#!/bin/bash + +. "/home/kevin/.cache/wal/colors.sh" +ticker=$(~/scripts/kraken $TICKER) +printf "%s\n\n%s\n" "$ticker" "$color7" diff --git a/dot_config/mpv/input.conf b/dot_config/mpv/input.conf index 93f37ac..677027a 100755 --- a/dot_config/mpv/input.conf +++ b/dot_config/mpv/input.conf @@ -15,12 +15,12 @@ Ctrl+RIGHT no-osd seek 0.2 exact Ctrl+LEFT no-osd seek -0.2 exact Shift+RIGHT no-osd seek 1 exact Shift+LEFT no-osd seek -1 exact -RIGHT seek 3 -LEFT seek -3 -UP seek 10 -DOWN seek -10 -Shift+UP seek 60 -Shift+DOWN seek -60 +RIGHT seek 3 exact +LEFT seek -3 exact +UP seek 10 exact +DOWN seek -10 exact +Shift+UP seek 60 exact +Shift+DOWN seek -60 exact # mark m revert-seek mark # mark position for revert-seek diff --git a/dot_config/spotify/Users/polarbier-user/prefs.tmpl b/dot_config/spotify/Users/polarbier-user/prefs.tmpl deleted file mode 100644 index c713cff..0000000 --- a/dot_config/spotify/Users/polarbier-user/prefs.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -audio.play_bitrate_non_metered_migrated=true -audio.sync_bitrate_enumeration=4 -audio.crossfade_v2=true -gaia.attached_device_id="6ca6cdc7bc677d43534460982c3a13959dd1939c" -audio.play_bitrate_enumeration=4 -ui.hide_hpto=true -ui.track_notifications_enabled=false -audio.play_bitrate_non_metered_enumeration=4 -audio.normalize_v2=false -ui.show_friend_feed=false -app.player.volume=40000 -{{ if eq .chezmoi.hostname "x1-carbon" }} -app.browser.zoom-level=300 -{{ else }} -app.browser.zoom-level=75 -{{ end }} diff --git a/dot_gitconfig.tmpl b/dot_gitconfig.tmpl index 1c55249..ed14545 100644 --- a/dot_gitconfig.tmpl +++ b/dot_gitconfig.tmpl @@ -1,7 +1,7 @@ [user] email = kevin.mok@mail.utoronto.ca name = Kevin Mok - signingkey = C072BD80DB66DE18 + signingkey = 6DEED612B26C08E2 [color] ui = auto [core] diff --git a/dot_vimrc.tmpl b/dot_vimrc.tmpl index 8e4b0ff..fd8a054 100644 --- a/dot_vimrc.tmpl +++ b/dot_vimrc.tmpl @@ -76,8 +76,6 @@ autocmd Filetype markdown let g:AutoPairs = {'(':')', '[':']', '{':'}','"':'"', autocmd Filetype markdown let g:AutoPairs={'(':')', '[':']', '{':'}','"':'"', "`":"`", '```':'```', '"""':'"""', "'''":"'''","*":"*"} autocmd Filetype markdown map :InstantMarkdownPreview autocmd Filetype markdown map :InstantMarkdownStop:InstantMarkdownPreview -autocmd Filetype markdown inoremap >>A -autocmd Filetype markdown inoremap << >>A diff --git a/scripts/executable_kraken b/scripts/executable_kraken new file mode 100755 index 0000000..bf1f98e --- /dev/null +++ b/scripts/executable_kraken @@ -0,0 +1,8 @@ +price=$(curl -s "https://api.kraken.com/0/public/Ticker?pair=$1" | jq -r ".result.$1.b[0]") +# echo $price +if (( $(echo "$price < 10" | bc -l) )); then + printf "%0.3f\n" "$price" | cut -c 3- + # printf "%0.3f\n" "$price" +elif (( $(echo "$price < 10000" | bc -l) )); then + printf "%'0.0f\n" "$price" | sed 's/,//' +fi diff --git a/scripts/executable_ticker b/scripts/executable_ticker index 772f09d..9b149ad 100755 --- a/scripts/executable_ticker +++ b/scripts/executable_ticker @@ -86,16 +86,19 @@ for symbol in $(IFS=' '; echo "${SYMBOLS[*]}" | tr '[:lower:]' '[:upper:]'); do hour=$(date +"%H") if [[ "$symbol" == "USDCAD=X" ]]; then printf "%0.4f\n" "$price" - elif [[ "$symbol" == "BTC-USD" || "$symbol" == "ETH-USD" ]]; then + elif [[ "$symbol" == "BTC-USD" ]]; then # echo "$price" | cut -c 2-3 echo "$price" | cut -c -3 - elif [[ "$symbol" == "SOL-USD" ]]; then # echo "$price" | cut -c -4 - echo "$price" | cut -c -5 + elif [[ "$symbol" == "SOL-USD" || "$symbol" == "ETH-USD" ]]; then + echo "$price" | cut -c -4 + # echo "$price" | cut -c -5 elif (( $(echo "$price > 10000" | bc -l) )); then printf "%'0.0f\n" "$price" | cut -c 2-4 # elif (( $(echo "$price < 1" | bc -l) )); then # printf "%0.3f\n" "$price" + elif (( $(echo "$price > 100" | bc -l) )); then + printf "%'0.0f\n" "$price" | cut -c 1-3 else printf "%0.2f\n" "$price" | cut -c 3- # printf "%0.2f\n" "$price"