Skip to content

Instantly share code, notes, and snippets.

@chmouel
Last active February 1, 2016 15:21
Show Gist options
  • Save chmouel/05ffa97e0194b4d59e36 to your computer and use it in GitHub Desktop.
Save chmouel/05ffa97e0194b4d59e36 to your computer and use it in GitHub Desktop.
Upload directly to google drive the current screenshot, bind it to a keyboard shortcut (and pbcopy the output url) for ultimate effectiveness
#!/bin/bash
# Install gdrive: https://github.com/prasmussen/gdrive (in /usr/local/bin here)
# do a drive list and get a folder where you will upload the screenshot
gdrive_container="0B7bJ57bKfWfBY1RsMVF5OVA3TEk"
filename=$(date "+%F__%H-%M-%S-$RANDOM.png")
save_to="/tmp/$filename"
screencapture -i "$save_to"
if [[ -e "$save_to" ]]; then
url=$(/usr/local/bin/drive upload -p ${gdrive_container} --share -f ${save_to}|sed -n '/is now readable/ { s/.*@ //;p; }')
_surl=$(curl -s "http://is.gd/api.php?longurl=${url}")
echo $_surl
fi
@chmouel
Copy link
Author

chmouel commented Feb 1, 2016

Plugged to alfred like that, the Run script being this script :

2016-02-01__16-19-46-155

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