Created
October 19, 2009 14:32
-
-
Save jmesnil/213420 to your computer and use it in GitHub Desktop.
This file contains 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
RESP_FILE=/tmp/gist.tmp | |
rm -f $RESP_FILE | |
USER=`git config --global github.user` | |
USERAVAIL=$? | |
TOKEN=`git config --global github.token` | |
TOKENAVAIL=$? | |
if [ $USERAVAIL -eq 0 -a $TOKENAVAIL -eq 0 ]; then | |
AUTH="--data-urlencode login=$USER --data-urlencode token=$TOKEN" | |
fi | |
curl http://gist.github.com/gists --silent -i $AUTH --data-urlencode "file_contents[gistfile1]=$1" --data-urlencode "file_ext[gistfile1]=.txt" -o $RESP_FILE | |
cat $RESP_FILE|sed -ne '/Location/p'|cut -f2- -d:|tr -d ' ' | pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment