Skip to content

Instantly share code, notes, and snippets.

@mclemme
Last active January 2, 2016 11:09
Show Gist options
  • Save mclemme/8295015 to your computer and use it in GitHub Desktop.
Save mclemme/8295015 to your computer and use it in GitHub Desktop.
Tired of using your eyes to check how many dogecoins you've mined? Now you can use your ears ;-) This requires espeak to be installed and working, on Ubuntu/Debian based linux distributions you should be able to install it with: "sudo apt-get install espeak".
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Your mining address
ADDRESS='DGVboAJbUhnNzMn4F9z7D8LgaynphSU2Bb'
INTERVAL=300
from urllib2 import urlopen
from os import system
from time import sleep
from decimal import *
import sys
def fetch_balance():
balance = Decimal(urlopen('http://dogechain.info/chain/Dogecoin/q/addressbalance/'+ADDRESS).read())
return balance
def speak(words):
system("espeak '"+words+"' -v en+f3 -m -p 60 -s 120 --stdout|paplay")
balance = fetch_balance()
print 'Initial balance: '+str(balance)
while(True):
try:
new_balance = fetch_balance()
except Exception:
continue
print "FAAARK API DOWN!"
sleep(INTERVAL)
if(new_balance > balance):
difference = new_balance - balance
difference = round(difference, 2)
print '\nEarned: '+str(difference)+' new balance: '+str(new_balance)
speak(str(difference)+' dogecoins mined')
balance = new_balance
sys.stdout.write('.')
sys.stdout.flush()
sleep(INTERVAL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment