Skip to content

Instantly share code, notes, and snippets.

@professorjamesmoriarty
Created March 24, 2013 11:54
Show Gist options
  • Save professorjamesmoriarty/5231596 to your computer and use it in GitHub Desktop.
Save professorjamesmoriarty/5231596 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
#set -u
#set -o nounset
#Ozco API URL
URL=....
#defined functions
#-------------
pause(){
read -p "Press [Enter] key to continue..." fackEnterKey
}
one(){
curl -sS $URL | jshon > ozcoapi
pause
}
two(){
jshon -e pool -e hashrate -u < ozcoapi
pause
}
three(){
jshon -e pool -e round_efficiency -u < ozcoapi
pause
}
four(){
jshon -e pool -e round_duration -u < ozcoapi
pause
}
five(){
jshon -e user -e hashrate -u < ozcoapi
pause
}
six(){
jshon -e user -e current_payout_method -u < ozcoapi
pause
}
seven(){
jshon -e pot -e pot_value -u < ozcoapi
pause
}
eight(){
jshon -e pot -e estimated_payout_pot -u < ozcoapi
pause
}
nine(){
jshon -e pot -e pot_fee -u < ozcoapi
pause
}
#the menu
#-----------------------------
show_menus() {
clear
echo "Basic Ozcoin API Bash Script"
echo "Maintainer: Setkeh <setkeh at gmail dot com>"
echo "Commands:"
echo "1. Resync"
echo "2. Check Ozcoin Hashrate"
echo "3. Ozcoin Efficiancy"
echo "4. Round Duration"
echo "5. User Hashrate"
echo "6. User Payout Method"
echo "7. POT Share Value"
echo "8. Next Payout Value"
echo "9. Payout Method Value"
echo "10. Exit"
echo "NOTE: This scriptis incompleate and tuned to my needs"
echo "Licence: WTFPL <http://www.wtfpl.net/>"
}
#read options to pick from for menu
#-------------------
read_options(){
local choice
read -p "Enter choice [ 1 - 10] " choice
case $choice in
1) one ;;
2) two ;;
3) three ;;
4) four ;;
5) five ;;
6) six ;;
7) seven ;;
8) eight ;;
8) nine ;;
10) exit 0;;
*) echo -e "${RED}Error...${STD}" && sleep 2
esac
}
RED='\033[0;41;30m'
STD='\033[0;0;39m'
trap '' SIGINT SIGQUIT SIGTSTP
while true
do
show_menus
read_options
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment