Created
July 15, 2012 15:30
-
-
Save rduplain/3117464 to your computer and use it in GitHub Desktop.
Backup GitHub with dumb scripts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"A dumb script builder to clone scraped GitHub repo listings." | |
# 1. Scrape <ul id="repo_listing" class="repo_list"> into listing.html | |
# 2. python build_clone_script.py | sort -u > clone.sh | |
# 3. time sh clone.sh | |
from __future__ import print_function | |
import lxml.html | |
data = open('listing.html', 'r') | |
dom = lxml.html.fromstring(data.read()) | |
for element in dom.cssselect('.source'): | |
owner = element.cssselect('.owner')[0].text.strip() | |
repo = element.cssselect('.repo')[0].text.strip() | |
cmd = 'git clone --mirror git@github.com:{0}/{1}.git {0}-{1}.git'\ | |
.format(owner, repo) | |
print(cmd) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Updates all mirrored .git directories in the current directory. | |
for repo in *.git; do | |
pushd $repo | |
git fetch | |
popd > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment