Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
download Gists
#!/usr/bin/env python
# Clone or update all a user's gists
# curl -ks | python
# curl -ks | USER=fedir python
# USER=fedir python
import json
import urllib
from subprocess import call
from urllib import urlopen
import os
USER = os.environ['USER']
u = urlopen('' + USER + '/gists')
gists = json.load(u)
startd = os.getcwd()
for gist in gists:
gistd = gist['id']
if os.path.isdir(gistd):
call(['git', 'pull', 'git://' + gistd + '.git'])
call(['git', 'clone', 'git://' + gistd + '.git'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment