Created
December 31, 2012 17:31
-
-
Save clone1018/4421455 to your computer and use it in GitHub Desktop.
Minotar counter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
fname = "count" | |
def count_lines(fname): | |
with open(fname) as f: | |
for i, l in enumerate(f): | |
pass | |
return i + 1 | |
def count_requests(fname): | |
count = 0 | |
for line in file("count"): | |
line = line.split(' ') | |
count = count + int(line[0]) | |
return count | |
def count_time(fname): | |
lines = count_lines(fname) | |
time = 15 * lines | |
return time | |
data = { | |
'requests': int(count_requests(fname)), | |
'time': int(count_time(fname) * 60) | |
} | |
print json.dumps(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment