Skip to content

Instantly share code, notes, and snippets.

@h4sh5
Created July 3, 2022 02:14
Show Gist options
  • Select an option

  • Save h4sh5/96220d16fc8b3abe98b2c1217ef5ed3a to your computer and use it in GitHub Desktop.

Select an option

Save h4sh5/96220d16fc8b3abe98b2c1217ef5ed3a to your computer and use it in GitHub Desktop.
clone gists to current dir
#!/usr/bin/env python3
import json
import urllib
from subprocess import call
#from urllib import urlopen
from urllib.request import Request, urlopen
import os
import sys
USER = sys.argv[1] #os.environ['USER'] # or edit as appropriate
u = urlopen("https://api.github.com/users/%s/gists" % USER)
gists = json.load(u)
for gist in gists:
print(gist)
print('url:',gist['git_pull_url'])
call(['git', 'clone', gist['git_pull_url']])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment