Skip to content

Instantly share code, notes, and snippets.

@jdp
Last active January 29, 2016 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdp/e9f24666b335900c1f51 to your computer and use it in GitHub Desktop.
Save jdp/e9f24666b335900c1f51 to your computer and use it in GitHub Desktop.
Upload screenshot to imagebin and copy URL to clipboard. OS X only
#!/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