Skip to content

Instantly share code, notes, and snippets.

@clone1018
Created December 31, 2012 17:31
Show Gist options
  • Save clone1018/4421455 to your computer and use it in GitHub Desktop.
Save clone1018/4421455 to your computer and use it in GitHub Desktop.
Minotar counter
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