Skip to content

Instantly share code, notes, and snippets.

Created Oct 19, 2019
What would you like to do?
#!/usr/bin/env python
import os
import subprocess
import datetime
lastDate =
firstDate = lastDate - datetime.timedelta(days=7*52*3)
testDate = firstDate
with open("plot.dat", "w") as f:
reflist = []
while testDate < lastDate:
testDate += datetime.timedelta(days=7)
s = subprocess.Popen("git rev-list -1 --before='{}' origin/master".format(testDate), shell=True, stdout=subprocess.PIPE)
for i, ref in enumerate(reflist):
s = subprocess.Popen("git checkout {}".format(ref), shell=True, stdout=subprocess.PIPE)
s = subprocess.Popen("find -maxdepth 2 -name lib | xargs git grep -e \"\\bauto\\b\" --and --not -e \"\\bauto.* = .*<.*>\" | wc -l", shell=True, stdout=subprocess.PIPE)
assignCount =
f.write("{}, {}, {}\n".format(i, assignCount, ref))
with open("plot.gnu", "w") as f:
set title "auto usage over last 3 years"
set label "{firstDate}" at graph 0.00, 1.05
set label "{lastDate}" at graph 0.9, 1.05
unset multiplot
set style data lines
set term png size 1200, 800
set timefmt "%Y-%m-%d"
set output "autousage.png"
stats 'plot.dat' using 1 name 'x' nooutput
set xtics 0,10,x_max
set xlabel "Weeks since 2016-10-22"
set ylabel "Occurances of auto"
plot "plot.dat" using 1:2 t "assign"
set autoscale y
s =["gnuplot", "plot.gnu"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment