From cda9be2bf23b41a170beb1f6e4c4c5b6e863ae73 Mon Sep 17 00:00:00 2001 From: ziro Date: Tue, 19 May 2020 06:05:36 +0700 Subject: [PATCH] + Moved rateUSD.sh to .local/bin (To save up even more word count) --- .config/vim/vimrc | 1 + .config/zsh/.zshrc | 2 +- .config/zsh/aliases | 7 ------- .local/bin/custom/rateUSD | 6 ++++++ .scripts/rateUSD.sh | 4 ---- 5 files changed, 8 insertions(+), 12 deletions(-) create mode 100755 .local/bin/custom/rateUSD delete mode 100755 .scripts/rateUSD.sh diff --git a/.config/vim/vimrc b/.config/vim/vimrc index 76c136f..cb3a02d 100755 --- a/.config/vim/vimrc +++ b/.config/vim/vimrc @@ -82,6 +82,7 @@ else Plug 'ptzz/lf.vim' Plug 'rbgrouleff/bclose.vim' endif +Plug 'tpope/vim-commentary' call plug#end() diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index d89ffed..3496cea 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -6,7 +6,7 @@ # MOTDs pfetch echo "--------------------------------------" -sh ~/.scripts/rateUSD.sh +rateUSD #python ~/Currency/USD2IDR/rate.py #PYTHON IS JUST TOO SLOW FOR TERMINAL #sh ~/.scripts/motd.sh diff --git a/.config/zsh/aliases b/.config/zsh/aliases index e469dce..a0508ef 100644 --- a/.config/zsh/aliases +++ b/.config/zsh/aliases @@ -86,12 +86,5 @@ alias cmatrix='unimatrix -n -s 96 -l 'o'' alias cdclg='cd "$HOME/my Files/Kuliah/"' #Git Aliases -alias gcl='git clone' -alias gs='git status' -alias gaa='git add --all' -alias gcm='git commit -m' -alias gca='git commit -a' -alias gcam='git commit -a -m' -alias gp='git push' alias gR='git restore' alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME' diff --git a/.local/bin/custom/rateUSD b/.local/bin/custom/rateUSD new file mode 100755 index 0000000..ad69e00 --- /dev/null +++ b/.local/bin/custom/rateUSD @@ -0,0 +1,6 @@ +# get rate value from cnbcindonesia.com +[ ! "$(stat -c %y ~/.cache/rateUSD.txt 2> /dev/null | cut -d' ' -f1)" = "$(date "+Y-%m-%d")" ] && + curl -s "https://www.cnbcindonesia.com/market-data/currencies/IDR=/USD-IDR" | grep -A1 'class="mark_val"' | cut -d'"' -f2 | cut -d'<' -f2 | cut -d'>' -f2 > ~/.cache/rateUSD.txt + +# display rateUSD.txt while replace mark_val with Kurs USD -> IDR: +sed 's/mark_val/Kurs USD -> IDR:/' ~/.cache/rateUSD.txt; echo "Sumber: CNBC Indonesia" diff --git a/.scripts/rateUSD.sh b/.scripts/rateUSD.sh deleted file mode 100755 index 15ba804..0000000 --- a/.scripts/rateUSD.sh +++ /dev/null @@ -1,4 +0,0 @@ -# get rate value from cnbcindonesia.com -[ ! -f /tmp/rateUSD.txt ] && curl -s "https://www.cnbcindonesia.com/market-data/currencies/IDR=/USD-IDR" | grep -A1 'class="mark_val"' | cut -d'"' -f2 | cut -d'<' -f2 | cut -d'>' -f2 > /tmp/rateUSD.txt -# if rateUSD.txt exist then display it while replace mark_val with Kurs USD -> IDR: -[ -f /tmp/rateUSD.txt ] && sed 's/mark_val/Kurs USD -> IDR:/' /tmp/rateUSD.txt; echo "Sumber: CNBC Indonesia"