Created
February 22, 2013 21:57
-
-
Save sampowers/5016863 to your computer and use it in GitHub Desktop.
plonk
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/sh | |
. ~/.plonkrc # defines TWUSER and TWPASS. chmod 600 it... also define SMTPHOST there. | |
plonkmail() { | |
sendEmail \ | |
-f `whoami`@`hostname -f` -t $MAILTO -u "$1" -m `basename $1` \ | |
-s $SMTPHOST \ | |
-a "$1" | |
} | |
FILE=`mktemp /tmp/plonk.XXXXXX` | |
mv "$FILE" "${FILE}.png" | |
scrot -s ${FILE}.png | |
case "$1" in | |
twitpic) | |
eog $FILE.png & | |
MESSAGE=`zenity --entry --text="Tweet away, or cancel to bail."` | |
if [ -z $MESSAGE ]; then | |
rm $FILE.png | |
exit 1 | |
fi | |
curl \ | |
-F media=@${FILE}.png \ | |
-F username=${TWUSER} \ | |
-F password=${TWPASS} \ | |
-F message="${MESSAGE}" \ | |
http://twitpic.com/api/uploadAndPost | |
rm ${FILE}.png | |
;; | |
grab) | |
plonkmail ${FILE}.png | |
mv ${FILE}.png $GRABDIR | |
gnome-open $GRABDIR | |
;; | |
*) | |
echo "Usage: $0 {twitpic|grab}" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment