Skip to content

Instantly share code, notes, and snippets.

@chrisxaustin
Created May 2, 2024 12:41
Show Gist options
  • Save chrisxaustin/aeec1362092c8ce52fc88dda23f388a7 to your computer and use it in GitHub Desktop.
Save chrisxaustin/aeec1362092c8ce52fc88dda23f388a7 to your computer and use it in GitHub Desktop.
#!/opt/homebrew/bin/python3
import re
import json
import sys
import datetime
for filename in sys.argv[1:]:
with open(filename, 'r') as fh:
repo = re.split(r'/', filename)[-1]
raw = fh.read()
#print(raw)
try:
data = json.loads(raw)
for user in data:
login = user['author']['login']
for week in user['weeks']:
a = week['a']
d = week['d']
c = week['c']
epoch = week['w']
week = datetime.datetime.fromtimestamp(epoch).strftime('%Y-%m-%d')
print(f"{login}\t{repo}\t{week}\t{a}\t{d}\t{c}")
except Exception as e:
print(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment