Skip to content

Instantly share code, notes, and snippets.

@jdp jdp/
Last active Jan 29, 2016

What would you like to do?
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 -F file="@$fn" 2>/dev/null); then
echo "$upload" | grep '^url:' | sed 's/^url://' | pbcopy
afplay -v 2 /System/Library/Sounds/Glass.aiff &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.