### DIY screenshot sharing service

I often find it useful to send someone a screenshot - to facilitate some explanation, to point out a bug in some app, or maybe even just brag about my awesome desktop.

Obviously, I can open a terminal, start some screenshot app, save screenshot to file, upload a file somewhere, then figure out the link, etc - quite repetitive, I think.

Or I could use some of the new-and-popular screenshot uploading services - like Gyazo for example. But all those services require you to install some package or application, which looks ridiculous for such a simple task.

But we are Linux users, aren't we? We can always do better! Especially when we have some rusty bash skills, barely alive web-facing server somewhere in our closet, and half an hour of free time on our hands.
#!/bin/bash

f=$(mktemp -u screenshot_XXXXXX.png) import /tmp/$f
scp /tmp/$f server:/some/webroot/ rm /tmp/$f
url="http://your.server.hostname/$f" echo$url | xclip
echo $url | xclip -sel c echo$url

The above script uses ImageMagick's "import" command to let user select a rectangle on screen and save it to file, uploads that file to server (you'll need public key authentication set up for this to work without hassle), and puts url for newly created screenshot into clipboard using "xclip" utility.

I even bound this script to standard PrintScreen key, and now screenshot upload is a totally painless experience.

P.S. Actually, if you look closely, you will find that Gyazo's linux package does essentially the same. But I still don't like the idea of extra package for such task.