clipboard hacks – social copypasta

Have you ever had someone post you a code snippet, error, log data or some other type of long formatted text via an instant message or otherwise? It usually comes out all jacked up, formatting is off and its hard to read. If you have experienced this and find it annoying, then this script may be what you are looking for. Pastebin is a great alternative, however if you need privacy or security of the data you are sending is a concern, then that is not the best option.

So what does it do? Its pretty simple really. You highlight text, hit your hot key and paste a link that’s hidden away from the prying eyes of hackers or others looking to gather information.

Requirements:
1. Web server with scp access
2. Linux based desktop with X installed
3. Basic bash scripting knowledge

Installation:
1. Save the following script to your ~/bin directory

#!/bin/bash
FNAME="$(date +%s|md5sum|awk '{print $1}')"
xsel > /tmp/${FNAME} 
scp /tmp/${FNAME} user@host:documentroot/textshots/${FNAME}
echo "http://hostname/textshots/${FNAME}" | xsel -i
rm -f /tmp/${FNAME}

2. Edit the script to reflect the appropriate path, username and hostname

3. Make the script executable

chmod u+x ~/bin/script.sh

4. Setup your hot key: Great guide here provided by How-To Geek

5. Select some text and hit your hotkey
See it in action! Click Here – Thanks to Chris Haynie for the page title xD

Leave A Comment