Skip to content

Instantly share code, notes, and snippets.

@newzealandpaul
Created January 28, 2009 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save newzealandpaul/53879 to your computer and use it in GitHub Desktop.
Save newzealandpaul/53879 to your computer and use it in GitHub Desktop.
tinyurl on mac clipboard
#!/bin/sh
# tinyurl creator - places tinyurl on Mac OS X clipboard
# Usage: ./tinyurl http://www.google.com
# Credits: Based on this script: http://wtanaka.com/node/7750
URL=$(wget -q -O - -U "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8" --header="Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1" --header="Accept-Language: en" --header="Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7" --referer="http://tinyurl.com/" --header="Content-Type: application/x-www-form-urlencoded" --post-data="url=$*" http://tinyurl.com/create.php | sed -n 's/.*\(http:\/\/tinyurl.com\/[a-z0-9][a-z0-9]*\).*/\1/p' | uniq)
echo $URL | tr -d "\n" | pbcopy
echo $URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment