Last active
January 29, 2016 01:37
-
-
Save jdp/e9f24666b335900c1f51 to your computer and use it in GitHub Desktop.
Upload screenshot to imagebin and copy URL to clipboard. OS X only
This file contains 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
#!/usr/bin/env bash | |
set -e | |
declare fn | |
function cleanup { | |
rm "$fn" | |
} | |
trap cleanup EXIT | |
fn="$(mktemp -t cap).png" | |
screencapture -i "$fn" | |
mimetype=$(file --mime-type -b "$fn") | |
if [[ "$mimetype" == image/* ]]; then | |
if upload=$(curl http://imagebin.ca/upload.php -F file="@$fn" 2>/dev/null); then | |
echo "$upload" | grep '^url:' | sed 's/^url://' | pbcopy | |
afplay -v 2 /System/Library/Sounds/Glass.aiff & | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment