Share your clipboard easily between devicesS

An easy and universal service to share your clipboard contents between devices. That's what I needed to really help my workflow; I needed to be able to quickly share content from my phone to my PC and then to my Linux laptop. It was becoming a pain to have to email everything I needed to share. Then I discovered AirForShare (http://airforshare.com) which is a free serivce without any login required. Any computer/phone that has the same external IP address can access the website and view or share the same content. You paste in the content and press Save, and it will be available for 30 minutes on any other device you use in your wi-fi network. Very cool. But I wanted to super charge it by adding keyboard shortcuts; it was getting cumbersome to have to load/reload their webpage every time. So I made a couple of bash scripts:

To put new content to AirForShare:

curl —data-urlencode "yourText=`xclip -selection clipboard -o` http://airforshare.com/index.php

To get the latest content (into your clipboard):

curl -A "AirForShare/1.1 CFNetwork/609.1.4 Darwin/13.0.0" http://airforshare.com/apiv2/clip.php | xmlstarlet sel -t -c "//clipData/clipText/text()" | base64 -d | xclip -selection c

The above is for linux ('xclip' and 'xmlstarlet' are dependencies)

To run on windows (cygwin) just replace the xclip commands (and flags) with 'getclip' or 'putclip'.

To run on OSX just replace the xclip commands (and flags) with 'pbcopy' or 'pbpaste'.

Assign these scripts to keyboard shortcuts* and voila!

*(In windows create a shortcut and in the destination put

C:\cygwin\bin\run.exe /usr/bin/bash -l {{name of your .sh file}}

)