Saturday, March 21, 2009

Thesis working hours

A Python script follows, that shows the working hour statistics.


import sys
from subprocess import *

p1 = Popen(["git", "log"], stdout=PIPE)
p2 = Popen(["grep", "^Date"], stdin=p1.stdout, stdout=PIPE)
p3 = Popen(["awk", "{printf \"%d \", $5}"], stdin=p2.stdout, stdout=PIPE)
output = p3.communicate()[0]
hours = output.split()
stats = {}
for h in range(0,24):
stats[h] = 0
for h in hours:
stats[int(h)] += 1
for k in stats.keys():
print "%02d: %s" % (k, "*"*stats[k])





And the results...

00: *****
01: ***
02:
03: **
04:
05:
06:
07:
08:
09:
10: **
11: *****
12: ************
13: ************
14: **********************************
15: **********************
16: ************
17: **********
18: **
19: ***
20: ***
21: **
22: *
23:

No comments: