Skip to content

Instantly share code, notes, and snippets.

@seymores
Last active June 19, 2017 04:12
Show Gist options
  • Save seymores/4cf112d09262a615c3cbf39b91e01207 to your computer and use it in GitHub Desktop.
Save seymores/4cf112d09262a615c3cbf39b91e01207 to your computer and use it in GitHub Desktop.
Ethermine BitBar Plugin
#!/usr/bin/env ruby
# <bitbar.title>Ethermine BitBar Plugin</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Seymour Cakes</bitbar.author>
# <bitbar.author.github>https://gist.github.com/seymores/4cf112d09262a615c3cbf39b91e01207</bitbar.author.github>
# <bitbar.desc>Quick latest hashrate and unpaid values.</bitbar.desc>
# <bitbar.dependencies>ruby,httparty</bitbar.dependencies>
require 'httparty'
address = "YOUR_ETHMINE_ADDRESS_HERE"
url = "https://ethermine.org/api/miner_new/#{address}"
response = HTTParty.get(url)
output = response.parsed_response
hashrate = output['hashRate']
up = output['unpaid']
unpaid = (up.to_f/1000000000000000000).round(6)
puts "#{unpaid} @ #{hashrate}"
puts "---"
puts "#{address} | color=green href=https://ethermine.org/miners/#{address}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment