Thursday, March 24, 2011

cli based unix 1337 nerdy tweety perl client win!

Found this one, have to love it as a nerd:

http://gabrielcain.com/projects/twitter/.

Simply grab the code from lpa with:
jcuff@srv:~$ bzr branch lp:twitter-cmdline
add this line to the twitter.pl:
use lib '/home/jcuff/twitter-cmdline/';
Then you are good to go!
jcuff@srv:~/twitter-cmdline$ ./twitter.pl
What's your twitter login? jamesdotcuff
What's your twitter password?


I fancied setting up some unix 1337 scrolly updates, so I mucked about with the script to modify the formatting a little. Awesome Text::Format via [sudo apt-get install libtext-format-perl], helped and then simply added a unix "watch" with a 5 min delay, and some lovely color. Congrats to Gabriel Cain for the code - perl hacks for the win!
jcuff@srv:~/twitter-cmdline$ watch -n300 --color "./twitter.pl -R jamesdotcuff | tail -19"

Duh winning ;-)

jcuff@srv:~/jctweet$ diff twitter.pl ../twitter-cmdline/twitter.pl 
20,33d19
< use Text::Format;
< 
< my $text = Text::Format->new (
<   {
<     justify =>  1,
<     columns => 52,
<     firstIndent => 0,
<     leftMargin => 1,
<     hangingIndent => 1,
<   }
< );
< 
< use lib '/home/jcuff/twitter-cmdline/';
< 
173d158
<                 $a=~ s/ \+0000//g;
175c160
<         
---
>   
177,178c162,163
<    print RED, " [",$u,"] ", RESET, GREEN, $a , RESET, BLUE;
<                         print $text->paragraphs($s), RESET, "\n";
---
>    print GREEN, $a, RESET, ":", RED, $u, 
>     RESET, ":", CYAN, $s, "\n", RESET;

[any opinions here are all mine, and have absolutely nothing to do with my employer]
(c) 2011 James Cuff