diff options
Diffstat (limited to 'tmux')
-rwxr-xr-x | tmux/date.sh | 2 | ||||
-rwxr-xr-x | tmux/vcs_info.sh | 25 |
2 files changed, 16 insertions, 11 deletions
diff --git a/tmux/date.sh b/tmux/date.sh index ce6e0eb..9667fdd 100755 --- a/tmux/date.sh +++ b/tmux/date.sh @@ -38,7 +38,7 @@ RESULT=$(date +"%a %D %H:%M") DAY="#[fg=colour255 bg=colour31]"$(echo "$RESULT" | gawk '{print $1}') DATE="#[fg=colour255 bg=colour31]"$(echo "$RESULT" | gawk '{print $2}') TIME="#[fg=colour255 bg=colour31]"$(echo "$RESULT" | gawk '{print $3}') -INTERNET_TIME_RESULT=$(date -u +"%T" -d @$(curl -s --connect-timeout 10 --socks5-hostname localhost:9054 --user-agent "$(get_random_ua.sh)" http://worldtimeapi.org/api/timezone/Europe/London.json | jq '.unixtime')) +# INTERNET_TIME_RESULT=$(date -u +"%T" -d @$(curl -s --connect-timeout 10 --socks5-hostname localhost:9054 --user-agent "$(get_random_ua.sh)" http://worldtimeapi.org/api/timezone/Europe/London.json | jq '.unixtime')) # UTC_TIME_RESULT=$(date -u +"%H:%M") # UTC_TIME="#[fg=colour255 bg=colour25]"${INTERNET_TIME_RESULT} UTC_TIME="#[fg=colour255 bg=colour25]"$(internet_time_cache) diff --git a/tmux/vcs_info.sh b/tmux/vcs_info.sh index 673c07e..88c9e92 100755 --- a/tmux/vcs_info.sh +++ b/tmux/vcs_info.sh @@ -73,29 +73,34 @@ function get_eth_price { # eth_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price") # cake_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price") # monero_price=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price") - if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_ETH ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + if [ $(($(stat --format=%Y $PRICE_CACHE_OUTPUT_ETH) + PRICE_TIME_CACHE)) -gt "$(date +%s)" ]; then : else - if ETH_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price"); then - echo "${ETH_OUTPUT}" > ${PRICE_CACHE_OUTPUT_ETH} + if ETH_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=ETH&unit=USD" | jq ".price"); then + if [ -n "${ETH_OUTPUT}" ]; then + echo "${ETH_OUTPUT}" >${PRICE_CACHE_OUTPUT_ETH} + fi fi fi - if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_CAKE ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + if [ $(($(stat --format=%Y $PRICE_CACHE_OUTPUT_CAKE) + PRICE_TIME_CACHE)) -gt "$(date +%s)" ]; then : else - if CAKE_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price"); then - echo "${CAKE_OUTPUT}" > ${PRICE_CACHE_OUTPUT_CAKE} + if CAKE_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=CAKE&unit=USD" | jq ".price"); then + if [ -n "${CAKE_OUTPUT}" ]; then + echo "${CAKE_OUTPUT}" >${PRICE_CACHE_OUTPUT_CAKE} + fi fi fi - if [ $(( $( stat --format=%Y $PRICE_CACHE_OUTPUT_XMR ) + PRICE_TIME_CACHE )) -gt "$( date +%s )" ];then + if [ $(($(stat --format=%Y $PRICE_CACHE_OUTPUT_XMR) + PRICE_TIME_CACHE)) -gt "$(date +%s)" ]; then : else - if XMR_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price"); then - echo "${XMR_OUTPUT}" > ${PRICE_CACHE_OUTPUT_XMR} + if XMR_OUTPUT=$(proxychains4 -q -f ~/proxies/ice/proxychains.conf curl -s -X GET "https://api.terminaldweller.com/crypto/v1/price?name=XMR&unit=USD" | jq ".price"); then + if [ -n "${XMR_OUTPUT}" ]; then + echo "${XMR_OUTPUT}" >${PRICE_CACHE_OUTPUT_XMR} + fi fi fi - result="$(cat ${PRICE_CACHE_OUTPUT_ETH})"/"$(cat ${PRICE_CACHE_OUTPUT_CAKE})"/"$(cat ${PRICE_CACHE_OUTPUT_XMR})" echo "${result}" } |