Skip to content

Instantly share code, notes, and snippets.

@that4chanwolf
Created August 26, 2012 17:54
Show Gist options
  • Save that4chanwolf/3482081 to your computer and use it in GitHub Desktop.
Save that4chanwolf/3482081 to your computer and use it in GitHub Desktop.
Uploader
#!/bin/bash
# upload.sh (goput|omploadr|imgur) file
if [ "x${1}" = 'x' ]; then
echo 'need host'
exit
fi
if [ "x{$2}" = "x" ]; then
echo 'need filename'
exit
fi
case $1 in
omploadr)
curl --silent -i -F name=file1 -F file1="@${2}" http://ompldr.org/upload |
grep -Eo 'http://.+\.(png|jpg|gif)'
;;
goput)
curl --silent -i -F name=file1 -F file="@${2}" http://goput.it/gp5/handle.php |
grep -Eo 'value="http://.+"' |
sed -e 's/^value="//' -e 's/"$//'
;;
imgur)
HASH=`curl --silent -i -F name=file -F file="@${2}" http://imgur.com/upload | grep -Eo '\[\\".+\\"\]' | sed -e 's/^\[\\"//' -e 's/\\"\]//'`
echo "http://imgur.com/${HASH}"
;;
*)
echo 'Oh shit nigger, what are you doing?'
;;
esac
@Zanthas
Copy link

Zanthas commented Jun 18, 2013

mfw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment