Author Archives: Chris Haynie
I’ll fix it when its not broken.
Someone asked me recently what the tagline of my site meant. I figure I might as well go on record with the explanation and its origin.
I work in the web-hosting industry in unix server administration. Over the years I’ve had to support a variety of 3rd-party software products such as hosting control panels like Plesk and CPanel, as well as CMS systems like Joomla, Drupal, Wordpress, various platforms, configurations, etc the list is endless. At times, these vendors can push out software updates that will in turn break a customer’s website, server configuration, or cause an incompatibility etc, that is completely beyond my control. The vendor in this case needs to then release an additional patch to fix the issue, all the while I’ll still be expected to fix the customer’s website and get it back to a working state for them.
That being said, one time Plesk in particular had recently released an update which had caused a number of new issues, I don’t remember the specifics, however while trying to explain calmly that this was not something me nor my employer had any control over but was an issue caused by the vendor, in exasperation I said “I’ll fix it, when its not broken!”
Clipboard Snippeteering
I work in IT and frequently you may need to send someone a screenshot. Maybe its the configuration screen you’re looking at or the output of a command. As many of you know this procedure usually involves hitting print-screen on your keyboard, pasting it into a photo editor like ms-paint, saving it as a jpeg and what… do you send it over IM with a direct connection? email it to them? I wanted a solution where I can easily take a screenshot of just an area of the screen, or the entire screen if I choose and have it automatically upload the screenshot to a webserver, and allow me to paste the URL to the screenshot instantly. Ideally, I would have it even put the URL IN my clipboard as well, as it turns out this is all exactly what I accomplished.
I run Ubuntu on my workstation with compiz. You will need to install compizconfig-settings-manager, xsel, and ImageMagick for this all to work. Below is the script to perform the screenshot auto-magic, when combined with the compiz screenshot plugin. I press the windows key on my keyboard and then click+drag I have an instant screenshot.
FNAME="/home/chrisha/Documents/snippets/$(date +%s|md5sum|awk '{print $1}').jpg"
/usr/bin/convert -bordercolor white -border 5 $1 $1
/usr/bin/convert -bordercolor black -border 1 $1 $1
/usr/bin/convert -quality 75 $1 $FNAME
scp $FNAME slice:public_html/dev.chrishaynie.com/html/snippets/
echo http://slice.chrishaynie.com/snippets/$(basename $FNAME)|xsel -i
rm -f $1
Now then, lets say you want to send a large block of text – maybe its a snippet of code, maybe its the output of a command. Taking a screenshot of text isn’t verfy efficient, which we can agree. Traditional solutions have been just pasting it into the chat window and spamming the receiver, using sites like pastebin.com, but now your text is publicly available, maybe you’re wanting to send a snippet of some proprietary code or personal conversation.
My buddy Tim over at http://h1tman.com/ advanced my above screenshot auto-upload to include text excerpts, which get uploaded as plain-text. You bind his script to a keyboard shortcut and from there, you select the text, hit the keyboard shortcut and you’re off and running. You can read his full howto in depth here http://www.h1tman.com/2010/08/clipboard-hacks-social-copypasta
Now we get to the good part, I’ve combined both my original “screenshotuploader” with Tim’s “textshot” into what I’m going to call snippets. Use the same script in the screenshot plugin and in your keyboard shortcut for textshots, use the same url and same folder to store them all, in one combined script below.
#!/bin/bash
DIR="/home/chrisha/Documents/snippets/"
HOST="slice.chrishaynie.com"
HASH="$(date +%s|md5sum|awk '{print $1}')"
FNAME="$DIR$HASH"
if [ -z $1 ]
then
FNAME="$FNAME.txt"
xsel>$FNAME
else
FNAME="$FNAME.jpg"
/usr/bin/convert -bordercolor white -border 5 $1 $1
/usr/bin/convert -bordercolor black -border 1 $1 $1
/usr/bin/convert -quality 75 $1 $FNAME
rm -f $1
fi
scp $FNAME $HOST:public_html/dev.chrishaynie.com/html/snippets/
echo http://slice.chrishaynie.com/snippets/$(basename $FNAME)|xsel -i
Chrome OS
I’ve been playing with google’s Chromium-OS lately, following the instructions here I was able to get it booted off my eee-pc Netbook. In order to build it I first created a virtual machine on and installed a fresh copy of Ubuntu 9.10 (Karmic).


