Wednesday, May 23, 2012

Recovering formatted device with photorec

I recently got problem with my microSD card which I used in my SGS II phone - it tells that my card is not formatted, which is odd. I then use my another device to read, and try to reformat but seems the same message appeared.

Later, I tried to read it from my Linux Mint, it does not detected at all. By using looking at /dev/ seems there's device there.. so I opt to use mkfs to format the card, it worked.

However, that card contained many pictures of my lovely daughter and my wife.

My friend, later suggested to use "photorec", which is conveniently could be installed with [check first]:

$apt-cache search photorec
testdisk - Partition scanner and disk recovery tool

It's in testdisk package

To install:

sudo apt-get install testdisk

Try to play around with the flag, you recovered file could be located as you wish:

It's brilliant. Most of my files are recovered, although it seems scattered hence you need to find your important files by yourselves.

Wednesday, May 16, 2012

The lazy way to download PDF from a website

I usually stumbled to a website where it has many PDF (slides, research papers) and I don't want to bother to download them one by one.

So I simply use lynx with -dump option and grep:
For example:

lynx -dump|grep -o "http://*.*.pdf" > list

So in order to download them from the "list", I use curl (or you can use wget too)

for i in `cat list`;do echo $i;curl -C - $i -O;done

Done, easy eh?

Tuesday, May 15, 2012

Compiling Linux Kernel for Ubuntu

Sometimes I felt like I wanted to have a feeling of the new kernel, well my opinion is that Ubuntu and its derivatives aren't designed for such customizations, unless you're a developer.

The notes on kernel compilation is here . Basically for Ubuntu the way is slightly different and seems much easier since you don't have to edit the Grub configurations manually after you created the *.deb file for linux images and headers. Everything will be taken care for you.

My system is now, running Linux Mint 12 [derived from Ubuntu 11.10]

vostro-mint source # uname -a
Linux vostro-mint 3.4.0-1-i5 #3 SMP Tue May 15 00:23:33 MYT 2012 x86_64 x86_64 x86_64 GNU/Linux

vostro-mint source # cat /etc/issue
Linux Mint 12 Lisa \n \l

vostro-mint source # cat /proc/version
Linux version 3.4.0-1-i5 (root@vostro-mint) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) ) #3 SMP Tue May 15 00:23:33 MYT 2012

Thursday, May 10, 2012

Terminal record with ttyrec

Do you know that you can record your terminal session with ttyrec?

On Ubuntu/Mint this software can simply being installed by issuing 

sudo apt-get install ttyrec -y

The syntax is basically 

ttyrec [filename]

And your session will be recorded until you issue "exit" command

To replay the session simply use 

ttyplay [filename]


Wednesday, May 9, 2012

ipraytime, prayer time tool for Muslims

When it comes to prayer times, I usually checked for JAKIM's e-solat page, here . As it's the only trusted source for prayer times in Malaysia, it could have been hit by massive simultaneous access when it comes to the early of the month, because some applications simply grab the data from that website to feed their apps.

I rarely use ipraytime, but it does have features that I believe as accurate it could be. Ipraytime is included in Ubuntu/Mint, within itools package. Hence you can simply install by

sudo aptitude install itools -y 
or sudo apt-get install itools -y

The usage is fairly straight forward

You can get your current position by using latitude marker in google map, or your own smartphone.

Let say your position:3.14004,101.74932

ipraytime -lat 3.14004 -lon 101.74932 -a 1 -m

For Malaysia, usually the angle method is Egyptian General Authority of Survey so the -a flag is meant for that. -m is for monthly schedule.

Or you can simply put your favorite location in your $HOME/.iprayrc with the following format:

City: Ampang,Malaysia
Latitude: 3.13998
Longitude: 101.74940
AngleMethod: 1
UTC: 8

Hence when you invoke 
ipraytime -m

Later on or just ipraytime it will show the position that you have specified.
As for the output, some terminals do have problem with showing special characters. But it worked on old school terminals such as xterm and the minimalist mrxvt

Tuesday, May 8, 2012


This one not related to Ubuntu, as it is an interesting open source event-plus community driven; sure having this event is a bliss for the rest of us!

Date : May 18-20, 2012
Venue: Asia Pacific University College of Technology & Innovation (UCTI), Kuala Lumpur Malaysia [common open source, community based venue]

Have fun!

Monday, May 7, 2012

Linux based CLI meme generator

I wrote in my personal blog on the usage of "memegen" , a ruby based meme generator.

Read it here

Wednesday, May 2, 2012

Ubuntu for Production

I have been using Ubuntu since its earlier release and never look back after the change. Most of the time I used Ubuntu for my conference paper writings, preparing my presenation slides and so on.