Skip to content

Instantly share code, notes, and snippets.

@NanoAi
Created June 7, 2015 20:12
Show Gist options
  • Save NanoAi/dda335db840f56e86407 to your computer and use it in GitHub Desktop.
Save NanoAi/dda335db840f56e86407 to your computer and use it in GitHub Desktop.
Script for screencapture and auto send to server, on Mac OSX Yosemite.
SITE="http://i.mirai.red";
DIR=~/Screenshots/;
[email protected];
FLDR=/home/i.mirai.red;
NM=$(LC_CTYPE=C tr -dc "a-zA-Z0-9" < /dev/urandom | head -c 5).png;
FILE=$(screencapture -i $DIR$NM && echo $DIR$(ls -Art $DIR | tail -n 1));
if [ -a $FILE ] ; then
$(scp $FILE $SSH:$FLDR/$NM && ssh $SSH 'chown mirai-img $FLDR/$NM' && echo $SITE/$NM | pbcopy) && osascript -e 'display notification "Image Uploaded" with title "'"$SITE/$NM"'"' && rm -f $FILE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment