Created
February 10, 2012 15:58
-
-
Save cwarden/1790464 to your computer and use it in GitHub Desktop.
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 | |
| # Upload arbitrary files as a github gist using gisty. | |
| # Returns a bitly link to the gist. | |
| GIST_DIR="$HOME/git/gists" | |
| BITLY_USER=$USER | |
| BITLY_KEY=$(cat $HOME/.bitly_key) | |
| x=$(tempfile) | |
| echo "a gisty gist" > $x | |
| id=$(gisty post $x 2>&1 | awk '{print $3}') | |
| id=${id%%...} | |
| gist_dir=$GIST_DIR/$id | |
| cp "$@" $gist_dir | |
| cd $gist_dir | |
| git rm $(basename $x) | |
| git add * | |
| git ci -m'add extra files to gist' | |
| git push origin | |
| gist_url=https://gist.github.com/$id | |
| url="https://api-ssl.bitly.com/v3/shorten?login=$BITLY_USER&apiKey=$BITLY_KEY&longUrl=$gist_url&format=txt" | |
| curl $url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment