Skip to content

Instantly share code, notes, and snippets.

@brighteyed
Created September 26, 2019 08:25
Show Gist options
  • Save brighteyed/114d1203fc89c4f2a05f7c2726497a66 to your computer and use it in GitHub Desktop.
Save brighteyed/114d1203fc89c4f2a05f7c2726497a66 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from github import Github # pip install PyGithub
import json
import os
all = []
g = Github(open(os.path.expanduser("~/.gist")).read())
for gist in g.get_user().get_gists():
all.append({
"id" : gist.id,
"description" : gist.description,
"public" : gist.public,
"clone" : gist.git_pull_url,
"updated" : gist.updated_at.isoformat(),
"url" : gist.url,
})
# yuck
os.system("git clone '{0}' repos/{1}".format(gist.git_pull_url, gist.id))
with open("index.json", "w") as f:
f.write(json.dumps(all, indent=4) + "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment