Skip to content

Instantly share code, notes, and snippets.

@syui
Created December 5, 2014 17:48
Show Gist options
  • Save syui/6ce71e67f3e01f23a717 to your computer and use it in GitHub Desktop.
Save syui/6ce71e67f3e01f23a717 to your computer and use it in GitHub Desktop.
#!/bin/zsh
# github, bitbucket {{{
dot=`curl -s http://vim-jp.org/reading-vimrc/json/archives.json | jq -r '.[] | .vimrc | .[] | .url' | sed -e 's/\/github.com/\/raw.githubusercontent.com/g' -e 's/\/blob//g' -e 's/\/gist.github.com/\/gist.githubusercontent.com\/thinca/g' -e 's/\/src/\/raw/g'`
line=`echo $dot | wc -l | tr -d ' '`
for (( i=1; i<=$line;i++ ))
do
repo=`echo $dot | awk "NR==$i"`
echo $repo
file=`echo $repo | cut -d '/' -f 4`
echo $file
curl $repo -o $file
done
## github, bitbucket }}}
# gist {{{
dot=`echo $dot | grep "gist.githubusercontent.com" | sed 's/$/\/raw/g'`
line=`echo "$dot" | wc -l | tr -d ' '`
for (( i=1;i<=$line;i++ ))
do
repo=`echo "$dot" | awk "NR==$i"`
file=`echo "$repo" | cut -d '/' -f 5`
file=$dir/$file
curl $repo -o $file
done
### gist }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment