Dec 31, 2008

Home...

is where you make it!

Dec 10, 2008

Tag-fest

This has been on my to-do list for a little while now, ever since Mr.DarkDominion tagged me in THIS post... so it's been a while yea... So here it is. Sorry it took so long bro.

1. What’s your latest addiction?
genetic programming. I read about it on Hackaday, and now I can't seem to get my mind off it.

2. What are you listening to? 
a cricket :) it's eerily silent at the moment.

3. How late did u stay up last night and why?
Usually I stay up till 3 in the morning but last night was an exception. I think 11 pm :|

4. Who were you with last friday night?
Friday friday...forgetting my cousin's birthday...shit!!!! oh fuck...

5. Do you think you’ll be in a relationship 3 months from now?
YES!!!!!!

6. When is the next time you’ll see your close friends?
December 24th. You better be there at the airport nut.

7. what were you doing this morning at 7AM?
I was wacking my alarm clock for making that god-aweful noise

8. What radio station do u listen to the most?
I don't do radio... :|

9. What was the reason you last cried?
Hmm...that's a tough one. I'm not sure if talking about that here is such a good idea.

10. Have you ever talked to someone when they were high?
Yup. talked, yelled at slept with you name it.

11. What’s the fifth text in your inbox say?
"Tomorrow is mr.suresh's (a.k.a mama) birthday so don't forget to wish - benju"

12. Where was the last coffee shop you went to?
Cafe' Coffee day :|

13. What’s your outfit right now?
black pants, brown t-shirt.

14. What were you doing at 11pm last night?
sleeping dude sleeping.

15. Who was the last person you talked to last night before bed?
Talked to.. well if you consider issuing some commands to your computer "talking" then I suppose that would be my laptop. But in human terms that would be my room-mate. The bastard said he'd wake up in the morning to study. (but he didn't)

16. Will you be driving in a year?
Hopefully something bigger than what I'm driving now.

17. Is there anything that you are craving for right now?
a good movie!

18. When did your last hug take place?
not too long ago.

19. Have you ever started a sentence with “No offense, but…”?
Nah I always say something offensive and say "no offense" afterwards.

20. Do you drink tea?
Yea, I don't really like Coffee.

21. Have you ever been arrested?
ehehe ehehe...no.

22. Have you rode in someone else’s car today?
No

23. Have you made a mistake this past week?
Oh I've made plenty.

24. Who was the last person you texted?
My uh ..finance' :p

25. Are you happy with your life right now?
mostly yes, and then there are the days when I want to commit suicide..or homicide. the latter being the more common.

26. In the past 72 hrs have you been under the influence of sleep?
yea it's been a good day

27. What’s the connection between you and the last person you texted?
We're dating..and yea we're doing it :P

Yea so the tagging goes out to tholath and keyolhubey

Dec 6, 2008

Kapoing!!!!

Testing out mobile blogging software. This is just a test.



And yes this kind of shit does happen to me quite a lot these days. Worthless peice of junk!!!

Nov 25, 2008

Bash Script: Dhiraagu WebSMS

I've been noticing a lot of problems with Dhiraagu's WebSMS site, mostly that annoying "Session Expired" Errors. So I decided it was time for a major overhaul of my websms script. So here it is. enjoy! Don't forget to comment, and send bug-reports, suggestions, hate-mail etc.

first, a change-log

REV 0 : Initial Release

REV 1 :
+ Verbosity
+ Checking message length
* Cleaned up regex

REV 2 :
+ Directory (alias)
+ Error checking numbers

Ver 2.0:
25-Nov-2008
Major overhaul, re-written from scratch

* Moved directory out of script to external file
* Moved cookie to /tmp (changeable)
+ Added argument processing
* NUMBER must now be given as an argument to -n option
+ Added option to silence output
+ Added option to display help
+ Added option to override default user and pass
+ Added option to override default directory
* Will detect old cookie-and try to re-use instead of logging in every-time.
+ Error checking of username and password
+ Handles "Session expired" error to an extent.It will keep re-trying until success

* Some more small changes that I can't remember


Installation is pretty standard. It uses cURL to do the heavy lifting so you'll need that. The directory file now defaults to ~/.wsmsdir. This is a comma seperated text file with name-number pairs

eg:
hotchick1,123943
hotchick2,123432
daddy,12432
wife,1498052
Change the default values for user and pass. Although this is not required anymore because you can give username and password info to the script using the -u and -p options now. It is not recommended if you share you computer with snoopy people. The script will leave a cookie file in /tmp by default (change "cookiebase" to whatever you like if you want to change this) name USERNAME.wsmscookie (this can be changed on the fourth line from the bottom).If you consider this feature a security risk or something, uncomment the last line to delete the cookie everytime after you send a message.
#!/usr/bin/env bash

##########################################
##                                      ##
##               \|/                    ##
##              '-D                     ##
##             BDWSMS 2.0               ##
##       (Bash Dhiraagu Web-Sms)        ##
##                                      ##
##########################################
##                                      
##  Written By, kudanai [2008]                 
##  http://kudanai.blogspot.com         
## 
##  This script is released as-is and 
##  without any liability on my behalf.
##
##  You are free to make modifications  
##  and redistribute. Credits where they
##  are due are appreciated, but not 
##  necessary.
##
##  Please submit feature requests and 
##  bug reports to moc.liamg@ianaduk
##  (email address is written backwards)
##
##########################################

user=DEFAULT-USER
pass=DEFAULT-PASS

#---leave these if you don't know what they mean --##

dirlist=~/.wsmsdir
cookiebase=/tmp

## ----no need to edit beyond this point --##
version=2.0
cookie=0
number=0
msg=0
verbose=1 #change to 0 if you want silence as default
uflag=0
pflag=0

main()
{
 if [ -e ${dirlist} ];then dcheck=`cat ${dirlist} | grep -w ${number} | cut -f2 -d","`;fi 

 if [ -n "${dcheck}" ]
 then
  number=${dcheck}
 fi

 if [ -z `echo ${number} | grep -E "^7[6-9][0-9]{5}$"` ]
 then
  echo "ERROR: Invalid Number or unknown alias"
  exit 1
 fi

 if [ $verbose -gt 0 ]
 then
  echo "Sending to: ${number}"
  if [ `expr length "${msg}"` -gt 140 ]
   then 
       echo "WARNING: Message will be truncated at ...${msg:130:10}"
  fi
 fi

 if [ -e ${cookie} ]
 then
  if [ $verbose -gt 0 ];then echo "Found cookie file - will try to re-use";fi
  sendsms
 else
  login
 fi

}

login()
{
 if [ $verbose -gt 0 ];then echo "Authenticating ... Getting cookie";fi
 ret=`curl -s --compressed -c ${cookie} -d "username=${user}" -d "password=${pass}" \
  http://websms.dhimobile.com.mv/cgi-bin/websms/index.pl`

 if [ -n "`echo ${ret} | grep -i "password is incorrect"`" ]
 then
  echo "ERROR: Incorrect password"
  exit
 elif [ -n "`echo ${ret} | grep -i "you are not the"`" ]
 then
  echo "ERROR: Incorrect username"
  exit
 elif [ -n "`echo ${ret} | sed -n \"s/.*\( 0 more \).*/\1/p\"`" ]
 then
     echo "ERROR: Daily quota reached"
     exit
 else
     sendsms
 fi
}

sendsms()
{
 if [ $verbose -gt 0 ];then echo "Attempting to send message... ";fi
 ret=`curl -s --compressed -b ${cookie}  -d "mobilenumber=${number}" -d "message=${msg:0:140}" \
  http://websms.dhimobile.com.mv/cgi-bin/websms/send_message.pl`
 
 rem=`echo ${ret} | sed -n 's/.*\([yY]ou .* Day\).*/\1/p'`
 
 if [ -n "${rem}" ]
 then
  echo ${rem}
  exit
 else
  if [ $verbose -gt 0 ];then echo "ERROR: session expired? trying again";fi
  rm ${cookie}
  login
 fi
  
}

printhelp()
{
 echo "BDWSMS - KudaNai (kudanai.blogspot.com)"
 echo "Version: $version"
 echo "USAGE: $0 [OPTIONS...] -n number 'message'"
 echo
 echo "OPTIONS"
 echo " -h  Print this help and exit"
 echo " -v  Print version information"
 echo " -s  Silent. Supress additional information."
 echo " -d  Overried default directory file. The Directory file"
 echo "   is a comma seperated file containing name,number pairs"
 echo " -u USERNAME Override default username. Must use with -p"
 echo " -p PASSWORD Override default password. Must use with -u"
 echo
 echo "Please note that the -n argument is MANDATORY"
 exit 1
}

while getopts 'vshu:p:n:d:' OPTION
do
 case $OPTION in
  s) verbose=0 
   ;;
  v) echo "BDWSMS Version: ${version} [2008]"
   exit 0
   ;;
  u) user="${OPTARG}"
   uflag=1
   ;;
  d) dirlist="${OPTARG}"
   ;;
  p) pass="${OPTARG}"
   pflag=1
   ;;
  n) number="${OPTARG}"
   ;;
  h) printhelp
   ;;
  ?) printhelp
   exit;;
 esac
done

shift $(( $OPTIND - 1 ))
msg=$1

if [[ -z ${number} ]] || [[ -z ${msg} ]]
then
 printhelp
elif [[ ${uflag} -ne ${pflag} ]]
then
 echo "ERROR: You must specify values for both -u and -p options or not at all"
 printhelp
else
 cookie="${cookiebase}/${user}.wsmscookie"
 main 
fi

#rm ${cookie}

Nov 21, 2008

Automate birthday wishes on facebook

NEW VERSION IS OUT, and is now compatible with the latest (v0.95) version of fbcmd. You can find it HERE

EDIT 3: 02/DEC/08 - Fixed birthday issue for single digit days. Damn paddings...

EDIT 2: 23/NOV/08 - Fixed the incorrect date matching problem. You should update before the 2nd of December or you'll be in trouble.

EDIT: I fixed one serious error in the code, and updated the how to and made it..simpler.


let's face it, no matter how much you try you will always forget somebody's birthday and end up in a hole. I've been " " this close to death on several occasions now, and I'm actually reputed for having a good grip of the whole birthday business.

so last night I wanted to kill some time and I came up with a little bash script that might be of help to some of you. Basically what it does is

  1. Go online and grab the user ID's of everybody who's birthday falls on "today" (make sure your system clock is setup properly)
  2. Write a message on their wall

This is setup to run once a day, and voila! you have yourself a free ticket out of...birthday forgetters hell... *cough*

Should be fairly straightforward on any *nix system.

We'll be needing some way to access information on facebook. For that we're going to use fbcmd which is, as the developer describes "a simple command line interface for facebook." Go to the projects website here and download the latest version. At the time of writing, this was 0.90 (BETA)

Note that the patch file provided is for this particular version. I will update it if necessary in the future.

extract the archive to your home directory (places->home).
now download the patch file and script from here and also extract it to ~/fbcmd (directory should already exist from the previous archive)

Now go to the facebook application page, HERE and allow the application to access your information, and click "generate" to get an AUTH CODE for your account. Copy this down

open up a terminal now and run the following commands, one at a time.
sudo apt-get install curl php5-cli gnome-schedule
cd ~/fbcmd
patch -b -i fbcmd.diff fbcmd.php
php fbcmd.php AUTH XXXXXX
where XXXXXX is the AUTH CODE you copied down earlier. Now you should have access to your account through the application. Now we can move on to the wish script. In the same terminal type out the following.
php fbcmd.php FRIENDSC > fbUIDlist
gedit fbbdaywish
when the editor pops up, change the values for email, pass and put in your email ad and password. Change the value of "post" to whatever you want your friend to be greeted with. (TIP: avoid !'s, it causes some problems)

now type
gnome-schedule
The scheduled tasks dialog should come up. Click on new->recurrent. Enter any description you like. In the command field type
~/fbcmd/fbbdaywish >> ~/fbcmd/bday.log
uncheck the "no output" option, and select "every day" from the drop down menu. Click ok, and you're set to go!

Let me know how it turns out.

Nov 15, 2008

Testing out flock

testing testing 1....2...3..

Nov 6, 2008

Michael Crichton dies of cancer at 66 - DAMN!

So I was going through my daily news today and...damn! I didn't see this one coming for some time.
Michael Crichton, the legendary author of many of my all time favourites has passed away at the age of 66. I've read almost all of his books! Jurassic park, timeline, the andromeda strain, the great train robbery,empire of the sun, airframe, next, eaters of the dead, disclosure, prey.. you name it I've read them all.

Read the full story here http://blog.wired.com/underwire/2008/11/sci-fi-giant-mi.html

Now a moment of silence please :(

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"



Sep 29, 2008

RUKUFAN ORIGAMI: FISH 2

Ah! the saga continues. It's taken me a while to figure out how to make another one of these things, but then again I haven't really had much time of late to be...fiddling. (hah! liar)

Anyway here is an alternate version of a fish made out of Rukufan/Palm fronds. I believe that this version is the more historically common variant in the Maldives. So let's call it the "Maldivian version" or something hehe.

Click on the images for larger views. It might take a little while to load all the images, so please be patient.

let us proceed!


1) you will need one palm leaf, with the midrib removed, or two pieces of ribbon if you like that.



2) Tie a knot in the middle, just a simple knot. Notice how the shiny surfaces face away from each other. This is important if you want consistency in the final output. Tighten the knot.





3) Notice that on each side, the knot consists of a section of strip that goes all the way across (let's call it section A), and one that gets tucked under section A (call it section B). We will be working with the loose hanging strips coming from under section B. Take the upper strip, and fold it OVER Section A...



4) ...and tuck it under there. Tighten it up!




5) flip the fish over, and repeats steps 3 and 4 for this side. You should now have something that looks like this...



6) Good. We're almost there. We're still working with the same two ends we were just playing with. Take one, and twist that over to the other side from where it is, and tuck it under the crossing strip there. Repeat for the other one on the other side.



and Voila!




All you gotta do now is trim up those fins and you got yourself a fish! Here is what a finished fish may look like. Ideally this is done with a younger leaf. Notice Venus the guitar down there on the left, and the the DIY guitar stand she's sitting on.




Don't forget to check out other projects in the RUKUFAN ORIGAMI series

Sep 28, 2008

Guitar Chords: Dhonkamana (Trio)

Up on request from a fellow fan. Here is... Dhonkamana by Trio. A nice, feel good love song - perfect for serenading, if you're into that sort of thing. The strumming pattern may sound hard but it's actually pretty easy. pluck the A string (open), tap down the C chord, pluck G-B, tap - and repeat, and so on. If you're going to strum the chords and not pick, it's better to use barre chords instead, and C on the 8th fret.




intro - C F G C F G
(strum the chords lightly)

C
dhon kamana feneythoa
C
rashutherey ulhefymey
F C
fennaaneybaa libeyneybaa
C
dhon kamana feneythoa
C
rashutherey ulhefymey
F C
fennaaneybaa libeyneybaa
G F
thee magey raanee ey
G F C
hih edhey malikaaey fennaanebaa
C
libeyneybaa


C
vilaathah nookuraashey
C F
udumathin fehi kuraashe namaves
C
mivaa loebbeh badhaleh nuvaaney
C
loabivey inthihaa
C F
loabivey haadhahaa nethumun
C
vedhaaney fanaa dhuiniyain vedhaaney
G F
thee magey raanee ey
G F C
hih edhey malikaaey fennaanebaa
C
libeyneybaa
C
libeynebaa


C
dhon kamana feneythoa
C
rashutherey ulhefymey
F C
fennaaneybaa libeyneybaa
C
dhon kamana feneythoa
C
rashutherey ulhefymey
F C
fennaaneybaa libeyneybaa
G F
thee magey raanee ey
G F C
hih edhey malikaaey fennaanebaa
C
libeyneybaa
C
libeyneybaa
C
libeyneybaa
C F
libeyneybaa

Changing Facebook status with Bash, cURL - UPDATE!

Here's a little upgrade to the Facebook script.

Changes from the old version
1. Added some error checking should now detect failed/successful logins, and update attempt.
2. writes cookies to /tmp/ instead of $HOME


Not much of a changelog I know, but I suppose this makes for pretty much all the updating that this script would require. Don't forget to check out how to run this on the iPhone, although it does seem quite unnecessary since the Facebook app is pretty good.


#!/bin/bash


email=YOUR-EMAIL
pass=YOUR-PASSWORD

stat=$1
cookie="/tmp/"$RANDOM"fupdate"$RANDOM"cookiefile"

if [ -z "${stat}" ]
then
echo -e "\n\E[01musage\E[0m: \n fupdate 'your new status message'\n"
echo -e "The status should not be empty\n"
exit 1
fi

echo -n "Trying to log in..."
pfID=`curl -L --silent -A "MOZILLA/5.0" -b ${cookie} -c ${cookie} -d "email=${email}" \
-d "pass=${pass}" -d "login=Log+In" http://m.facebook.com/login.php | \
sed -nr 's/.*post_form_id" value="(\w+)".*/\1/p'`


if [ -z ${pfID} ];then echo "FAILED (no pfID)";exit 1;else echo "SUCCESS!";fi


echo -n "Trying to update..."
return=`curl --silent -L -A "MOZILLA/5.0" -b ${cookie} -c ${cookie} \
-d "post_form_id=${pfID}" -d "status=${stat}" \
-d "update=Update" http://m.facebook.com/home.php | \
sed -nr 's/.*(Your status has been updated).*/\1/p'`


if [ -z "${return}" ];then echo "FAILED";exit 1;else echo "SUCCESS!";fi

if [ -e ${cookie} ]
then
rm ${cookie}
else
echo "no cookie file? something went wrong?"
exit 1
fi

Sep 24, 2008

Guitar Chords: Dhenneveemey Gislaa (Fa'thu)

I don't know who's song this is originally, but it's quite familiar. Either way I think Fa'thu did a great job with it. The toned down chords and everything along with that husky voice...purr!!!

It's not a hard song to figure out, but for those of you who are a little...tone challenged, here it is!




[CHORUS]
Am
Dhenneveemey gislaa roe roe faa.
G
aashigaa ey loabin annaashey.
Dm Am
vee loabin maruvaan hey?
Dm Am
vee loabin maruvaan hey?

Am
Dhenneveemey gislaa roe roe faa...

Am G
Bunebalaashey! mithuraa edhevey gothei,
Dm Am
beynumiyya, hithugaa vaa haa gothei.
G
loabing koh dheynamey!
Am
ufalun koh dheynamey!

[CHORUS]

Am
Dhenneveemey gislaa roe roe faa...

Am G
vaudhuveemey, umurah ekugaa ulhen
Dm Am
mee thedhei kan aharen dhakkaanamey.
G
mikamah ruhifaanu hey?
Am
noonee maruvaanamey!

[CHORUS]

Am
Dhenneveemey gislaa roe roe faa...

Sep 17, 2008

Guitar Chords: Vaaneyhe Dhuniyeygaa (Midh-hath)

This is one of those songs that get stuck in your head for life! I don't even know when I saw the guy performing it on Heyyambo but I do remember the song, and a beautiful song it is! He sang it with such passion!!! I've been trying to get my hands on this song for a while now but nobody carried it anymore... a tragedy if you ask me!

Just as my luck would have it, kuda-ibbe (that fuck!) decided to ... sing (if you can call it that) this song on "thi handhaanuga" (what's next? magey handhaanuga?). As bad as his ridiculous performance was, it had the upshot of providing me with the lyrics of the song. I only remembered bit's and pieces of it until now, and I'm really hoping that the guy didn't fuck with the lyrics as well. I am literally in PAIN after listening to that. If any of you have the original version, holler in the comments please??? pretty please??

So here it is! very simple to play, nice and humble - none of that remix crap. I only noted on the first two, because the progression then repeats. You'll figure it out.

Dedicated to... I'd rather not say :|


C                          Am
vaaneyhe dhiniyeygaa thiya fadha fari nala malei
G C
dheevaana kollee magey, thiya hinithun vumey
C Am
maazee vi loabeege rey rey, ehandhaan vumun
G C
beynun vanee miyadhuves, eufaaveri kamey


F C
maafah edhen mulhi kaunu heki koffaa mirey
F C
loabeega kurevunu haa kushah eki rey
Am F
heelaafa bunelaa loabi mavamey,
Am G C
umurah ekeegaa vaanamey, magey loabivaa.

vaaneyhe dhiniyeygaa thiya fadha fari nala malei
dheevaana kollee magey, thiya hinithun vumey
maazee vi loabeege rey rey, ehandhaan vumun
beynun vanee miyadhuves, eufaaveri kamey

Oagaa velaafa bosdhee hadhaathee hiy uthuri ara-ey
Shaahee pareezaadhei hen mihithugaa ranikan kuraa shey
hibakommadheefin mulhi hiy mi-jaanaa,
kulunaai loabaa, agalah thiee hama evvana ey.

vaaneyhe dhiniyeygaa thiya fadha fari nala malei
dheevaana kollee magey, thiya hinithun vumey
maazee vi loabeege rey rey, ehandhaan vumun
beynun vanee miyadhuves, eufaaveri kamey

... repeat the chorus a bit and start crying!

Running Bash scripts on the iPhone

It's always nice to be able to carry your work around with you. You gotta love some good command line action while walking down the street! In any case, if you find yourself needing to run some scripts on the iPhone or iPod touch, here's what to do!

1) Jailbreak your phone! you ain't getting anywhere without doing it anyway.
2) Make sure you have Cydia installed and then install the packages openSSH, MobileTerminal, cURL (if you want to use my WebSMS and facebook update scripts).
3) Save the script on your PC
4) load up your SSH client (commandline, nautilus or winSCP for windows guys..etc..)
5) Copy the file over to /usr/bin on the phone (or the home directory if you like)
6) chmod the file to 775 (or 755?)


and you're done!
I've been using my WebSMS and Facebook Update scripts on the phone for a while now. They help reduce the overhead of nevigating throught those stupid websites to get things done. now it's in the commandline, nice and easy. Enjoy

P.S I know it's not a very good guide. I got lazy so sue me! This officially concludes the transfer of everything I consider to be of...substance... over from the old blog. New stuff from here on end! HURRAYYY!!!

Sep 16, 2008

Update Facebook status through Bash, using cURL

anger management part 2 peeps!

A nice simple bash script to update the status on facebook from the command line. Pretty straight forward, using cURL here again. As usual, edit the email and passord. Script takes one argument, the status. There's no error-checking so there really isn't a way to know if it was successful or not. I'll add that in sometime later.

I love cURL!

edit: some installation instructions for the younger peeps
1) copy past it into a new file on the desktop say fbupdater
2) open terminal, type "sudo cp /Desktop/fbupdater /usr/local/bin/fbupdater"
3) type "chmod a+x /usr/local/bin/fbupdater"



and that should do it.


#!/bin/bash


email=YOUR-EMAIL
pass=YOUR-PASSWORD

stat=$1

cd $HOME

echo "logging in"

pfID=`curl -L --silent -A "MOZILLA/5.0" -b cookie -c cookie -d "email=${email}" \
-d "pass=${pass}" -d "login=Log+In" http://m.facebook.com/login.php | \
sed -nr 's/.*post_form_id" value="(\w+)".*/\1/p'`

echo "updating"
curl --silent -L -A "MOZILLA/5.0" -b cookie -c cookie -d "post_form_id=${pfID}" \
-d "status=${stat}" -d "update=Update" http://m.facebook.com/home.php > /dev/null

if [ -e cookie ]
then
rm cookie
else
echo "no cookie file? something went wrong?"
fi

Bash WebSMS script using cURL

This post is the combination of all of the WebSMS scripts that I have posted to this date. This script will enable you to send text messages to Dhiraagu mobiles numbers via their websms site. As of the latest iteration, the script takes two arguments, the number (or alias) and the message.

but before that some setup notes for the n00bs
1) Save the script on your desktop, name it FILE (whatever you like)
2) Open up a terminal:
3) sudo cp ~/Desktop/FILE /usr/local/bin/sms
4) sudo chmod a+x /usr/local/bin/sms


from then on you can simply run it by typing "sms [number|alias] message" on the terminal

#!/bin/bash

user=YOUR-USERNAME
pass=YOUR-PASSWORD
number=$1
msg=$2

case "${number}" in

#--BEGIN DIRECTORY SEGMENT--##

hotchick1) number=7811223;;
hotchick2) number=7620382;;
hotchick3) number=7923423;;

#--END OF DIRECTORY SEGMENT--##

*)
if [ -z `echo ${number} | grep -E "^7[5-9][0-9]{5}$"` ]
then
echo "ERROR: Number not valid"
exit
fi
;;
esac


cd $HOME

echo -e "\nSending to ${number}\nMessage is `expr length "${msg}"` characters long"

if [ `expr length "${msg}"` -gt 140 ]
then
echo "Message will be truncated at ...${msg:130:10}"
fi

echo "Authenticating ... Getting cookie"
if [ -n "`curl -s --compressed -c cookiejar -d \"username=${user}&password=${pass}\" \
http://websms.dhimobile.com.mv/cgi-bin/websms/index.pl | \
sed -n \"s/.*\( 0 more \).*/\1/p\"`" ]
then
echo "ERROR: Daily quota reached"
exit
fi

echo "Attempting to send message... "
curl -s --compressed -b cookiejar -d "mobilenumber=${number}&message=${msg:0:140}" \
http://websms.dhimobile.com.mv/cgi-bin/websms/send_message.pl | \
sed -n 's/.*\([yY]ou .* Day\).*/\1/p'
echo -e "Done!\n"

rm cookiejar



for historical reasons, and because some people may prefer the older versions, they are included below.

#!/bin/bash

cd $HOME

user=$1
pass=$2
number=$3
msg=$4

echo -e "\nAuthenticating ... Getting cookie"
if [ -n "`curl -s --compressed -c cookiejar -d \"username=${user}&password=${pass}\" \
http://websms.dhimobile.com.mv/cgi-bin/websms/index.pl | \
sed -n \"s/.*\( 0 more \).*/\1/p\"`" ]
then
echo "Shit! You've hit that quota."
exit
fi

echo "Message is `expr length "${msg}"` characters long"

if [ `expr length "${msg}"` -gt 140 ]
then
echo "Message will be truncated"
fi

echo "Attempting to send message... "
curl -s --compressed -b cookiejar -d "mobilenumber=${number}&message=${msg:0:140}" \
http://websms.dhimobile.com.mv/cgi-bin/websms/send_message.pl | \
sed -n 's/.*\([yY]ou .* Day\).*/\1/p'
echo -e "Done!\n"

rm cookiejar


and of course the first ever version of it, unbloated simplicity in itself.

#!/bin/bash
#usage "./websms username password number message"

cd $HOME

curl --progress-bar -c cookiejar -d "username=${1}&password=${2}" \
http://websms.dhimobile.com.mv/cgi-bin/websms/index.pl | grep -i "day" | \
sed -e 's/<[^>]*>//g;s/^[ \t]*//'

curl --progress-bar -b cookiejar -d "mobilenumber=${3}&message=${4}" \
http://websms.dhimobile.com.mv/cgi-bin/websms/send_message.pl | grep -i "day" | \
sed -e 's/<[^>]*>//g;s/^[ \t]*//'

rm cookiejar

Guitar Chords: Gilan (Ali/Ibrahim rameez)



Before we begin let's make something absolutely clear. I am not an Ali/Ibrahim Rameez fan. I just happen to like this song. Anyway.. here it is :)

Dedicated to my friend Falibe (who IS a fan)


INTRO plucking C G/B C G/B ...

C G
Hithugaa Vaa Handhaaneh Fohevey Hey? Noonekey
C G Am
Ithubaaraa Huvaa Thah Nethuneemaa Gislanee


F G
Loabi Veemaa Vaudhu Veemey
C
Eyge Fahugaa Kehi Dhinee
F G
Beywafaa Vee, Haadha Dhera Ey
C
Neygi Huttaa Badhalu Vee



C G
Hithugaa Vaa Handhaaneh Fohevey Hey? Noonekey
C G Am
Ithubaaraa Huvaa Thah Nethuneemaa Gislanee


F G
Loabi Veemaa Vaudhu Veemey
C
Eyge Fahugaa Kehi Dhinee
F G
Beywafaa Vee, Haadha Dhera Ey
C F
Neygi Huttaa Badhalu Vee
G Am C G F
Heekuree Hey Dhaane Hen, Dhashuvaan
G C
Fasbaigaa Eligen Roanehey


(SOLO)

C G
Aniyaa Dhee Hedheemey Badhunaamey Adhuvanee
C G Am
Umurah Dhen Salaamey Rulhiveemaa Foohivee


F G
Loabi Veemaa Vaudhu Veemey
C
Eyge Fahugaa Kehi Dhinee
F G
Beywafaa Vee, Haadha Dhera Ey
C F
Neygi Huttaa Badhalu Vee


(SOME CHEESEY ENGLISH STUFF
YEAAA YOU TELL THAT BITCH!!)
.................... F


G Am C G F
Heekuree Hey Dhaane Hen, Dhashuvaan
G C Am
Fasbaigaa Eligen Roanehey
F G
Loabi Veemaa Vaudhu Veemey
C
Eyge Fahugaa Kehi Dhinee
F G
Beywafaa Vee, Haadha Dhera Ey
C
Neygi Huttaa Badhalu Vee


(WAIL THE CHORUS OVER A FEW TIMES)



Not the most perfect I know but it works. I think it's a G/B throughout the entire thing but the G works fine for me so I use it. Let me know if you have a different version in the comments. Thanks to lavafoshi for the lyrics.

HDR Imaging

If you're anything like me, and you enjoy a good sunset then you'll probably know what this is about. Have you ever wanted to capture all those colours on your digital? maybe you tried, but it always seems so so much blander than the real thing? Well that's because you can only get so many colors on there. HDR saves the day! it stands fo High Dynamic Range. Basically - more colors :) Here's a picture I took today, nothing fancy but gets the point across.



and the same done HDR



see the difference? I'm telling you it's the shit! Especially if you have one of those really cheap cameras..like me :( Basically what you do is take three shots (or more) with varying levels of exposure (one under, one over and one just right), and then combine them. It's quite easy in photoshop (since CS2, there's a "merge to HDR" option somewhere in there) Now you might want to consider upgrading your camera's firmware to CHDK, which will allow you, among other things to a) Shoot in RAW, and b) shoot with auto bracketing. Both these will help you immensly with the HDR business (specially shooting RAW) have a look into it. It's worth your while.

RUKUFAN ORIGAMI: Bird

I got to spend some quality time with my friend NISHAM today, and learned how to make that bird. So here is part..err..five.. of this ongoing series. Right then lets begin. You need two strips (basically one "fanvai" (leaf) with the eakle removed) The first step is to tie a basic knot towards one end of one of the strips. Which should give you this.


Notice how there's a bit left on the right (ooh oxymoron!). This will form the tail section so leave enough for it there, but not too much so that you'll run out of material later. Now you take the second strip and insert it into the knot like so.


Notice how the shiny side faces up? yea that's important if you want all shiny on the outside when you're done. Got it? now hold that intersection down and turn the thing around...


So far so good. Take the lose end of the second strip, and run it between the protruding tail section.


Note how the non-shiny side faces up. Alright now here's where it gets a whee bit tricky. observe the next picture carefully. We're still playing with the lose end of the second strip here.
See how it goes around, between the tail and into the knot. That end now needs to over OVER the loop formed by the second strip itself. Notice how I'm holding the thing? Holding it like this helps keep the strip from coming out of the tail section. Now pull the through that knot and over that loop like this.

Alright now grab the two lose ends that form the tail with one hand, and the other two with the other hand, and pull! carefully now.


Pull that nice and tight. You're almost done with the body section. Alright now after you've tightened that up you should have something like this.
You should have four loose ends, two on each side. Of those, on of them are going to be neatly tucked and the other is going to be on the outside like is shown in the picture above. What you need to do is make an incision on the cross strip to tuck that loose strand in.


Repeat that for the other side as well. Congratulations, you have now completed the body. You should have a nice even structure now, with the loose strips of one end being shorter (the tail, which is also complete) and the other much longer (for the head and wings.)

Now we go for the wings and head. On the head side, make a similar incision to the one you made to tuck in that loose end. Next, pull the strip through it (not completely), forming a loop.


Repeat for the other side as well,


That loop needs to be roughly the same size as the width of the strips (because you're going to pull them through it). Now for the wings, take one of the ends and pull it through that incision yet again, forming a second (larger) loop that will form the wings


Repeat this for the other side as well, which will leave you something like... this


Great now you've got wings. You're almost done now, just a few more loops. It's time to form that head! Take one of the ends, and insert it into the loop that is further away from it.


here's another perspective on that one..


Don't tighten that up just yet. You need to loop the other loose end OVER the one you just formed, and into it, then thread it through the small loop that's away from it...



Alright now you can tighten it. Slowly pull that through (grab the beak) to form...


see that? Yay you did it! All that's left to do now is cut those things up into any shape you like and you're done. Congratulations! You are now becoming more and more with nature.Here's the one I just made to take pictures for this tutorial.



No comments about my hand needing moisturizer please. I already know that :P
If you enjoyed that, make sure you check out the others in this series.

RUKUFAN ORIGAMI: Fish

Alright peeps here we go, by popular demand, this here is the nice illustrated guide to making a "fish" out of coconut palm fronds (SO THAT'S what they're called!!!). You could also just make it out of two strips of paper I suppose. I'm not feeling particularly vocal today, So I think I'll avoid the yapping and let the diagrams do the talking. There's a PDF version up for grabs down there. Click the image for a larger view.

You start off with two strips (remove the "iloshi" from one and you'll have two..get it?) and using that...



And tighten. Cut off the excess into whatever shape of fins you like. If you got it right, here's what the finished product looks like (more or less)



Neat huh? I'm particularly happy about how the diagrams came out. If you liked that please take some time to check out my previous posts, and don't forget to tell your friends.

DOWNLOAD PDF VERSION

Don't forget to check out the rest of the rukufan series.

RUKUFAN ORIGAMI: Mission statement of sorts

Well I'm positively delighted by the amount of positive responses I got from the last two posts. I would like to clarify one thing to you guys though, I am in no means an expert in the matter. I'm just learning this as I go, so please do bear with me. I've decided to push ahead with this as I've developed quite a fascination with this most extraordinary art-form.

Unfortunately though, I'm a few thousand miles away and without access to the local knowledge pool so what I can learn over here is pretty limited. I've been asking my friends if any of them know about the subject but alas, it seems the rest of my generation here is as oblivious as I am. I seem to have however, sparked their interest - as I hope I have done yours as well. It is my sincere hope that more people will be able to share their knowledge with us. Those of you who can, please take some time to learn at least some simple stuff, and if possible share it with us. I think it'd be a great way to spend time with your parents/grand parents.

On a more positive note, I've been told that there is one particular Maldivian here who is likely to know quite a bit about it, and I'm going to try and hunt him down. It seems he organized and weaved a "Bodumas" for a cultural festival here so there's definitely promise of getting some very exciting stuff out of him. The "Bodumas" is perhaps the pinnacle of the art-form and a symbol of our nationality.

I will post how to make that fish (which I THINK was taught to me by my farther) soon.

In other news, Elton John is still gay.

RUKUFAN ORIGAMI: bashi (ball?)

After having FINALLY learnt how to make one of those things last night, I spent some time this morning to draw up some diagrams on how to make it for those of you who haven't had the fortune of inheriting this particular piece of our heritage. A bashi is a woven cube from palm fronds that was often used as a ball. So here goes!

Basically you need to two leaves, long and healthy and without any insect holes (believe me when I raped the palm tree last night I got my fair share of "unsuitable" ones)

Next you'll need to cut it into nice long (anything longer than a foot works I guess) strip. Leave the rib (iloshi) intact when you do this. Ok so now you got two nice long strips of "fan" (kekek) to play with. Now you need to take out the iloshi while leaving a small bit of it - roughly the same as the width of a half leaf- (from the side where the iloshi is narrower) holding the two segments of the leaf together, so you should have something like this.



Got it? Great! now for the next step. Take one of these, and pull one of it's legs between those of the other one. Lay them on each other at right angles. Confused? Check the diagram :p


Alright now to get started with the weaving. It's easier if you have the "legs" facing away from you. I'll name each one (there are four right?) as a,b,c and d (starting from the left). Ok now you need to pull "a under b", and "d over c". Remember "a under b" and "d over c". Like so



notice how the "d" was on the underside and "a" on the top side before you began. Ok now after the "a under b" and "d over c" move, you cross a and d in a "a over d" move. It might be a little handful at first buy you'll get the hang of it. the "a over d" move is like so -


Are we having fun yet? The above move will leave you with something looking like this




NOW TIGHTEN!!! pull it hard you bitches!!! (whoa hey not so much!) alright now that completes one weave. It's going to try and bend (that's supposed to happn so let it happen) Congratulations! Now you'll once again have four legs facing away from you. Rename (a-d) from the left again, and start over from the "a under b" move, and then when you reach this point again, start over again..over...and over...and over.. and OOOOOVVEERRRRRRRRRR... until you're almost out of "leg", (or you the thing is as big as you want. You need four weaves minumum...I think. Let's play on the safe side and make it a five weave minimum) at which point it's now time for you to "tuck in".

You do this by pulling the legs under the weave. I couldn't draw this (bah!), so I took a picture and drew arrows on it ;)



Pull that through,TIGHTEN, repeat it for all the legs for a couple of times and cut off the rest. (It would probably we wise to leave your own legs intact)

Congratulations! You are now a proud Maldivian :)

Happy weaving. Post pictures if you make it. Now then, does anybody know how to make those pretty little bird things? Goddamnit I should've payed more attention as a kid huh? Maybe I would've learned something other than to make a "Gadi"!

Seriously though if any of you do know how to make one, do post. OR teach me how to make one so I'll post it :p

Sharing is caring people sharing is caring.

Now check out this fish I made. Ok so it's not the prettiest thing but hey I'm no "pro"