Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Clone or update a user's gists locally
curl -ks | USER=${USER} python3
#!/usr/bin/env python3
# Clone or update all a user's gists
# curl -ks | bash
# curl -ks | USER=nicerobot bash
import json
from subprocess import call
from urllib.request import urlopen
import os
USER = os.environ['USER']
with urlopen(''+USER+'/gists') as u:
startd = os.getcwd()
for gist in json.loads('utf8')):
gistd = os.path.basename(gist['html_url'])
pull = gist['git_pull_url']
if os.path.isdir(gistd):
call(['git', 'pull', pull])
call(['git', 'clone', pull])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.