You are not logged in.
I wrote a small script to make urls tiny quickly. dependencies are curl and xclip (for convenience)
there are two possible ways to use this:
1. copy an url to the X clipboard, run the script (e.g. through a hotkey) and immediately paste the tinyurl again.
2. pass an URL as the first and only argument and tadaa, there is the tinified url on STDOUT (and also in the clipboard)
#!/bin/sh
#
# title: tinify
# author: Philip Stark
# desc: pass an url as the first and only argument to make it tiny or
# leave it away and it takes the content of the clipboard by
# calling xclip.
# licenced under the WTFPL (http://sam.zoy.org/wtfpl/)
if [ "$1" = "" ]; then
tinyurl=$(curl http://tinyurl.com/api-create.php?url=$(xclip -selection clipboard -o) 2> /dev/null)
echo $tinyurl;
echo $tinyurl | xclip -selection clipboard -i;
else
url=$1;
tinyurl=$(curl http://tinyurl.com/api-create.php?url=${url} 2> /dev/null)
echo $tinyurl;
echo $tinyurl | xclip -selection clipboard -i;
fi
version without xclip dependency (to keep it simple ):
#!/bin/sh
# title: tinify
# author: Philip Stark
# desc: pass an url as the first and only argument to make it tiny or
# leave it away and it takes the content of the clipboard by
# calling xclip.
# licenced under the WTFPL (http://sam.zoy.org/wtfpl/)
[ "$1" == "" ] && echo "Usage: tinify url" && exit
url=$1;
tinyurl=$(curl http://tinyurl.com/api-create.php?url=${url} 2> /dev/null)
echo $tinyurl;
have fun
cheers Barde
Last edited by Heller_Barde (2009-02-17 18:50:05)
Offline
Handy! I just might have to use this
Offline
What is the point of licensing small helper scripts like this? de minimis non curat lex and all that.
Offline
Does the size of the script matter? Its still someones work.
There shouldn't be any reason to learn more editor types than emacs or vi -- mg (1)
[You learn that sarcasm does not often work well in international forums. That is why we avoid it. -- ewaller (arch linux forum moderator)
Offline
Does the size of the script matter? Its still someones work.
Are you kidding?
Offline
i was actually kinda kidding about the licensing. it was very late and i was very tired so I decided i wanted to do a little bit of effort and make a real description and a license. it was even funnier considering the tinyness of the script
cheers Barde
Last edited by Heller_Barde (2009-02-17 18:35:14)
Offline
I have to agree that I thought slapping a license on a few simple lines of code was quite disturbing, however useful the code might be... until I read the license and laughed.
The copyright line though...
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Nice script thanks for sharing
Mr Green I like Landuke!
Offline
The copyright line though...
true, now that i am not tired anymore, it makes no sense anymore brb, gotta steal a line from my own script
Offline