Bitcoin Forum
May 05, 2024, 07:18:00 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Tutorial] Mac Os X + GeekTool = bitcoin monitoring on your desktop!  (Read 3247 times)
NR3000 (OP)
Member
**
Offline Offline

Activity: 86
Merit: 10



View Profile
July 20, 2013, 02:18:00 PM
Last edit: July 21, 2013, 01:55:04 PM by NR3000
 #1




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

Drag and drop shell icon to your desktop:



Go to properties -> command -> …



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


 



*** 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 Grin 1DXuRTFTJXpQBKKmcXjvy6nYRhNGTFJap6

1714893480
Hero Member
*
Offline Offline

Posts: 1714893480

View Profile Personal Message (Offline)

Ignore
1714893480
Reply with quote  #2

1714893480
Report to moderator
"With e-currency based on cryptographic proof, without the need to trust a third party middleman, money can be secure and transactions effortless." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714893480
Hero Member
*
Offline Offline

Posts: 1714893480

View Profile Personal Message (Offline)

Ignore
1714893480
Reply with quote  #2

1714893480
Report to moderator
1714893480
Hero Member
*
Offline Offline

Posts: 1714893480

View Profile Personal Message (Offline)

Ignore
1714893480
Reply with quote  #2

1714893480
Report to moderator
1714893480
Hero Member
*
Offline Offline

Posts: 1714893480

View Profile Personal Message (Offline)

Ignore
1714893480
Reply with quote  #2

1714893480
Report to moderator
NR3000 (OP)
Member
**
Offline Offline

Activity: 86
Merit: 10



View Profile
July 21, 2013, 01:52:44 PM
Last edit: July 23, 2013, 06:17:25 PM by NR3000
 #2

Script for BTC Guild!



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 " ----- "

grobbes
Member
**
Offline Offline

Activity: 60
Merit: 10


View Profile
July 23, 2013, 03:48:05 PM
Last edit: July 23, 2013, 06:25:57 PM by grobbes
 #3

EDIT: NVM figured it out
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!