Skip to content

Instantly share code, notes, and snippets.

@HAOYUatHZ
Last active January 17, 2019 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HAOYUatHZ/bf2242ee830d3293eb4910fb686d8473 to your computer and use it in GitHub Desktop.
Save HAOYUatHZ/bf2242ee830d3293eb4910fb686d8473 to your computer and use it in GitHub Desktop.
# grep -o -E 'MinerName=.* +diff=[0-9]+' copy.log > all_stats.log
filename = "all_stats.log"
all_earn = 453.259264136
from collections import defaultdict
d = {}
d = defaultdict(lambda: 0, d)
diff_sum = 0
fee = 0.97
with open(filename) as file:
for line in file:
line = " ".join(line.replace("MinerName=", "").replace("diff=", "").split())
parts = line.split(" ")
user = parts[0]
diff = int(parts[1])
d[user] = d[user]+diff
diff_sum = diff_sum + diff
print "all_earn", all_earn
print "diff_sum", diff_sum
print ""
for user in d:
weight = d[user]*1.0/diff_sum
print "percent:%f\tearn:%f\tpay:%f\tuser:%s" % (weight, weight*all_earn, weight*all_earn*fee, user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment