Bitcoin Forum

Bitcoin => Mining support => Topic started by: NR3000 on July 20, 2013, 02:18:00 PM



Title: [Tutorial] Mac Os X + GeekTool = bitcoin monitoring on your desktop!
Post by: NR3000 on July 20, 2013, 02:18:00 PM

http://s17.postimg.org/kkiftymlb/Screen_Shot_2013_07_20_at_14_38_21.png

Download GeekTool from http://projects.tynsoe.org/en/geektool/download.php

Drag and drop shell icon to your desktop:

http://s2.postimg.org/5kzv9hdtl/Screen_Shot_2013_07_20_at_14_55_16.png

Go to properties -> command -> …

http://s17.postimg.org/3vcekb0m7/Screen_Shot_2013_07_20_at_14_34_28.png

Enter script and save changes. Also you can change font and color in properties

http://s17.postimg.org/qmq2kgb1b/Screen_Shot_2013_07_20_at_14_37_58.png
 



*** Some scripts ***

Show MtGox rates:

Quote
#!/usr/bin/python

import json
import urllib2

def parse(json_data):
    json_data = json.loads(json_data)

    # get to where the days are listed with the data we want.
    high = json_data['data']['high']['display_short']
    low = json_data['data']['low']['display_short']
    avg = json_data['data']['avg']['display_short']

    return high, low, avg

def fetch():
    # url with API code intact.............TTTHHHIIIISSSSSS
    url = 'https://data.mtgox.com/api/2/BTCUSD/money/ticker'

    try:
        # gets the data from the url and reads it like a file
        response = urllib2.urlopen(url).read()
    except urllib2.URLError:
        sys.exit()

    return response

if __name__ == '__main__':
    response = fetch()
    high, low, avg = parse(response)
    print "High: %s" % (high)
    print "Low : %s" % (low)
    print "Avg : %s" % (avg)

Show network difficulty
Quote
#!/usr/bin/python
import urllib2
 
def get_info(url):
    info = urllib2.urlopen(url)
    ats = info.read()
    return(ats)
  
next = int(float(get_info('http://blockexplorer.com/q/estimate/')))
now = int(float(get_info('http://blockexplorer.com/q/getdifficulty')))
perc = 100 - (100 * now / next)

print "Now ", now
print "Next ", next
print "Difference %s (%s%%)" % ((next - now), perc)



Please share your own scripts!

Working with btcguild statistics - completed
Working with slush pool statistics

If you like this tutorial, you can buy some beer for me ;D 1DXuRTFTJXpQBKKmcXjvy6nYRhNGTFJap6


Title: Re: [Tutorial] Mac Os X + GeekTool = bitcoin monitoring on your desktop!
Post by: NR3000 on July 21, 2013, 01:52:44 PM
Script for BTC Guild!

http://s11.postimg.org/aowh9oo37/Screen_Shot_2013_07_21_at_14_49_17.png

Quote
#!/usr/bin/python

import urllib2
import json

API_KEY = 'YOUR API KEY HERE'

my_json = json.loads(urllib2.urlopen('http://www.btcguild.com/api.php?api_key=' + API_KEY).read())

total_rewards = my_json['user']['total_rewards']
paid_rewards = my_json['user']['paid_rewards']
unpaid_rewards = my_json['user']['unpaid_rewards']
past_24h_rewards = my_json['user']['past_24h_rewards']
pool_speed = my_json['pool']['pool_speed']

print " -- BTC Guild Pool Stats --"
print "Total rewards : %.8f" % total_rewards
print "Paid rewards  : %.8f" % paid_rewards
print "Unpaid rewards: %.8f" % unpaid_rewards
print "24h rewards   : %.8f" % past_24h_rewards
print "Pool speed    : %s" % pool_speed
print "---------------------------"

for worker in my_json['workers']:
  workerhashrate = my_json['workers'][worker]['hash_rate']
  workershares = my_json['workers'][worker]['valid_shares']
  workerstales = my_json['workers'][worker]['stale_shares']
  if(workershares > 0 and workerstales > 0) :
      workerstale_perc = float(workerstales)/float(workershares) * 100
  else:
      workerstale_perc = 0.0
  print "Worker name: %s" % (my_json['workers'][worker]['worker_name'])
  print "Worker Hashrate %.2f  Shares %d  Stales %d Stale %.2f %%" % (workerhashrate,  workershares, workerstales, workerstale_perc)
  print " ----- "


Title: Re: [Tutorial] Mac Os X + GeekTool = bitcoin monitoring on your desktop!
Post by: grobbes on July 23, 2013, 03:48:05 PM
EDIT: NVM figured it out