Oct 31, 2008

My kinda elections...! hehe

Alright then, now that the "other" elections are over it's now time for my sort of elections. Don't take me for being shallow, I do give shit - a Lot of shit! and I don't mean the poopy kinda shit either. I'm talking real hard stuff here.

Now then, It's time for this years show-down season of the Linux distributions. We had Debian releasing the fifth revition of Etch a couple of days ago to get things started. Get your hats on kiddies, it's gonna be a fun ride this time around, with lots of exciting stuff going down. Today we have one uh...goat...going nuts in the neighborhood. Ubuntu's out people! and YEAAAHHH!!!! it's gonna be awesome! My wireless card is finally gonna get some native loving. Thank you Mr.kernel 2.6.27 :D

Hot on it's heels we got openSUSE, Fedora and simplyMEPIS. Let's see if openSUSE can convince me to ditch Ubuntu this time around. The last one didn't go so well for me personally. It's good, but just not good enough...for me :) Debian of course is the way to go if you're all hardcore [and have a lot of spare time (read Gentoo)] but I did try that, and it really wasn't for me.

so here we go..ready..annnnnnnnnnnnnnnnd... let the downloading begin :)

Oct 25, 2008

Ping Pong...!

just letting everybody know that I'm alive.

Oct 11, 2008

Scraping facebook email addresses

Last night I had a dilema - I came to realize that I don't even have a fraction of my friends email addresses in my contact book, which is a very bad thing by any means. Of course there's facebook for ya! but it's still no substitute for some good ol' emails.

So I thought maybe I could simply get them off of facebook - no go!

why? Facebook doesn't provide plain-text email adds, which presents a bit of a problem. After a little research, it became clear that FB uses one of those string-to-image scripts. Hah! easy I thought, I'll just decode the Base64 string and voila... as it happens it's not that easy. It's not a Base64 string and to be honest I couldn't figure out what it was. So that left me with the other option - OCR

This didn't prove too difficult at all. For the most part all I had to do was go through all my friends profile pages, extract the string_image hash, and pass that to

http://m.facebook.com/string_image.php?ct=XXXXXXX&fp=8.7&state=0

where ct takes the has, and fp is a float that controls the size of the output image. 8.7 is standard. you can crank that up to improve the OCR detection rate. I found 35 to be the optimal value between size and clarity.

based on this, i was able to whip up a quick bash script to take in a list of User-ID's (just a bunch of numbers that corrospond to a given user. Do what you will to grab that), grab the email image and use OCR on it. I used OCRAD to do the OCR, and imagemagick for convertion.

EDIT: It saddens me that some people have been making money off the code that I wrote. I helped you guys out in good faith. Really sucks that you took advantage of it. Anyway, I've decided to re-post the code here so the lamesters can be exposed for what they are. I'm posting the rewritten perl code here, since the original bash thing didn't work anyway.

NOTE: I have made some deliberate omissions here. modifications are needed before the code will be functional. you WILL GET BANNED by facebook if you overdo it.

here's the bash stuff:

BOING BOING!!! where did the code go? SOrry guys, I had to remove it.

and in perl: (the xxxx's should be easy to figure out if you see my other scripts)

#!/usr/bin/perl
use strict;
use xxxxx;
use xxxxx;
use Image::Magick;
use Shell qw[ocrad];

my $username = @ARGV[0];
my $password = @ARGV[1];
my $iurl;#temp var
my $id;  #temp var
my $x;   #temp var
my $uids="uids"; #path of uid list file
my $idlist="idlist"; #path of output file
my $size=35;  #size of email image to download

my $mech = xxxxxxx->new();
my $image = Image::Magick->new();

$mech->cookie_jar(xxxxxxxxx->new());

#login
$mech->post("https://login.facebook.com/login.php?m&next=http://m.facebook.com/inbox",{email=>$username,pass=>$password});

#star processing uids
open(UIDS,$uids);
open(IDLS,">>$idlist");
foreach $id ()
{
  chomp($id);
  $mech->get("http://m.facebook.com/profile.php?id=".$id."&v=info&refid=17");
  if(defined ($iurl=$mech->find_image( url_regex => qr/string_image.php/ )))
  {
    ($iurl=$iurl->url_abs())=~s/8.7/$size/;
    chomp($iurl);
    $x = $image->Read($iurl);
    $x = $image->Write(gamma=>0.3,colorspace=>'rgb',filename=>$id.".ppm");
    print IDLS "$id,".ocrad("$id.ppm")."\n";
    @$image = ();

   }
   else 
   {
    print IDLS "$id,undefined\n";
  }
}

close(UIDS);close(IDLS);

This works remarkably well for the most part, although ocrad did confuse some 1's for l's. I had better results with tesseract - but had to convert all the images to bi-tonal graymaps first. otherwise it's simply useless.

Oct 2, 2008

DIY 3-axis ballhead tripod thingie (a.k.a The tennis-ballpod!)

Make a ballhead tripod out of nothing more than a tennis ball, a nut, and a can of pringles?

Ahhh what the mind of a cheap ass guy who's bored to death can cook up. I've always wanted one of those mini-tripod things that I could carry around in my pocket, but have been either too lazy or too cheap to actually buy one...well mostly just lazy. I'm not really a photography geek anyway.

'Nuff talk, let's get down to business. On with this unholy abomination, kinda-sorta dedicated to iekko and her new camera.

First here is the finished product.



Let's get started.

Let's go digging in your garage. We're looking for the following items.
  • one tennis ball
  • one tube that snugly fits the tennis ball, like a can of lay's stax (pringles seem to be a bit larger)
  • one 1/4" bolt (make sure it's got the right tread), a nut, a butterfly nut and a washer.
That's all!


Take the ball, and poke a hole in it using a knife or something. In retrospect it's better if the hole is actually a HOLE and not a cross cut like I did here.



I made two mistakes in the above step. Like I said, it's better if you can make a whole (roughly the size of the bolt, maybe a bit larger but not too large), and the second mistake being I opened it up too much. Be careful!

Next, insert the bolt head first into the hole. place a washed on top to snug it up a bit, and insert a nut. Tighten the nut as much as you can. And voila! the ball is done! (btw these tennis balls stink like ass when you open em up.. just a warning.



Now we move on to the can. Tape up the bottom. Use a piece of cardboard to plug it up if it already isn't. I'm not using a Lay's Stax can or anything, because I found this empty tube in which some badminton shuttles came it. This thing fits like a glove! Also, if you bought your tennis balls in a can, that is probably the best one to use for this. There are plenty of options out there, explore! find something you can use.


Cut the can up. The height of it should be somewhere between the center of the ball and the top. (ie, taller than it's radius, shorter than the diameter) In my case, the lid of the can was indented so I cut it up to the size of the diameter.




Not take the lid, and cut a hole in it so that it will fit the ball snugly on the top. you may need to give this a couple of tries to get it just right. don't worry it's well worth the effort.




And that's pretty much it! all you have to do now is put the ball in the can, the lid ON the can and tape/glue it to keep it in place. I chose to tape it because, well to be honest I didn't know how it'd turn out.



Now for the butterfly nut. You put this on the bolt , backwards. This is so that when you screw the camera on, you can unscrew the bolt towards the camera and make a snug fit. I couldn't find a butterfly nut so I used a regular nut instead.

That's it! you have yourself a tennis-ballpod! This thing turned out to be surprisingly versatile, and much better to use in practice than I had originally anticipated. The one pictured above gives me about 120 degrees of movement around the two horizontal axes and 360 around the vertical. Not too shabby.

You might want to add a little weight to the bottom to keep it from tipping over when the camera is tilted all the way over. As it is, it's able to support my point-and-shoot almost all the way without any problems. I wouldn't recommend using this with a bigger camera, although with better construction, it should easily be able to "handle it"