Skip to content

Instantly share code, notes, and snippets.

@gravitylow
Last active August 29, 2015 14:03
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 gravitylow/f0967bca841d81e95a05 to your computer and use it in GitHub Desktop.
Save gravitylow/f0967bca841d81e95a05 to your computer and use it in GitHub Desktop.
Ten.Java Gource Creator
# I'm not a python developer
import json
import urllib
import urllib2
from subprocess import call
url = "https://tenjava.com/api/participants?repos=1";
devnull = open('/dev/null', 'w')
def collect():
data = json.load(urllib2.urlopen(url))
for i in range(0, len(data)):
name = data[i]["gh_username"].lower();
entry = data[i]["time_entry"];
print "Collecting data from {} user {}/{}".format(name, i+1, len(data))
for time in entry:
if entry[time] is 1:
repo = name + "-" + time
collect_user(repo)
def collect_user(repo):
execute("git clone git@github.com:tenjava/{}.git".format(repo))
execute("gource --output-custom-log {}.txt {}".format(repo, repo))
execute("sed -i -r \"s#(.+)\|#\\1|/{}#\" {}.txt".format(repo, repo))
def execute(c):
call(c, shell=True, stdout=devnull, stderr=devnull)
collect()
print "Combining all user data.."
execute("cat *.txt | sort -n > combined.txt")
print "Output: combined.txt"
print "To view: gource -f 1280x720 --hide filenames,dirnames --disable-bloom combined.txt --hide-root"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment