]> git.mjollnir.org Git - scripts.git/commitdiff
added liip.to script
authorPenny Leach <penny@mjollnir.org>
Tue, 15 Sep 2009 08:41:30 +0000 (10:41 +0200)
committerPenny Leach <penny@mjollnir.org>
Tue, 15 Sep 2009 08:41:30 +0000 (10:41 +0200)
bin/liip [new file with mode: 0755]

diff --git a/bin/liip b/bin/liip
new file mode 100755 (executable)
index 0000000..b871d04
--- /dev/null
+++ b/bin/liip
@@ -0,0 +1,21 @@
+#!/usr/bin/perl -w
+
+use strict;
+use LWP::UserAgent;
+
+my $service = 'http://liip.to/api/txt/';
+my $url = $ARGV[0];
+my $code = $ARGV[1];
+
+$url  ||= scalar(`xclip -o`);
+$code ||= '';
+
+$url =~ s/\s$//;
+$code =~ s/^\s//;
+$code =~ s/\s$//;
+
+
+my $postargs = ['url',  $url, 'code', $code ];
+
+my $response = LWP::UserAgent->new->post($service, $postargs);
+print $response->content . "\n";