Skip to content

Instantly share code, notes, and snippets.

@taiyoh
Created September 27, 2013 01:58
Show Gist options
  • Save taiyoh/6723216 to your computer and use it in GitHub Desktop.
Save taiyoh/6723216 to your computer and use it in GitHub Desktop.
#!/bin/sh
GYAZO_HOST="example.com"
GYAZO_PORT=8080
GYAZO_PATH="/foo/bar"
NOW=`date +"%s"`
TMPFILE="/tmp/$NOW.jpg"
gnome-screenshot --area --file $TMPFILE 2> /dev/null
if [ -f $TMPFILE ]; then
IMG_URL=`curl -F "imagedata=@$TMPFILE" http://$GYAZO_HOST:$GYAZO_PORT$GYAZO_PATH 2> /tmp/gyazo_error.log`
if [ $IMG_URL ]; then
gnome-www-browser $IMG_URL > /dev/null
else
cat /tmp/gyazo_error.log
fi
fi
if [ -f $TMPFILE ]; then rm $TMPFILE; fi
if [ -f /tmp/gyazo_error.log ]; then rm /tmp/gyazo_error.log; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment