Skip to content

Instantly share code, notes, and snippets.

@iranzo
Created June 28, 2019 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iranzo/1c01c1296cf20c13d954562c39d36466 to your computer and use it in GitHub Desktop.
Save iranzo/1c01c1296cf20c13d954562c39d36466 to your computer and use it in GitHub Desktop.
Argos extension to calculate the money earned so far today
#!/usr/bin/env bash
# Author: Pablo Iranzo Gómez (Pablo.Iranzo@gmail.com)
# Description: Script to calculate earned money so far in the day
# Adjust DAILY to the daily income, adjust DAYSTART hour and DAYEND hour to your working schedule
# Customize to suit your details
DAYSTART="8:00"
DAYEND="17:00"
DAILY=1000
SYMBOL="€"
URL="github.com/p-e-w/argos"
DIR=$(dirname "$0")
EARNED=""
DAILYTOTAL=$(echo "scale=4; $DAILY/(9*60*60)"| bc)
UNIXSTART=$(date --date="${DAYSTART}" +"%s")
UNIXNOW=$(date +"%s")
UNIXEND=$(date --date="${DAYEND}" +"%s")
if [[ ${UNIXNOW} -gt ${UNIXEND} ]]; then
EARNED=${DAILY}
elif [[ ${UNIXNOW} -gt ${UNIXSTART} ]]; then
EARNED=$(echo "scale=2; $DAILYTOTAL * (${UNIXNOW}-${UNIXSTART})" | bc)
else
EARNED="0"
fi
STRING="💰 ${EARNED}${SYMBOL} 💰"
echo "$STRING | refresh=true"
echo "---"
echo "$URL | iconName=help-faq-symbolic href='https://$URL'"
echo "$DIR | iconName=folder-symbolic href='file://$DIR'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment