Monday, June 2, 2008

Clip, cut, split mp3 files using dd

I accidentally discovered a wonderful use of the dd command on ubuntu.

clip mp3 files.

It looks like mp3 format does not have any header or footer. So copying some contiguous bytes from somewhere in the file seems to create another valid mp3 file. WOW!

I have a large mp3 ("041-oru maalai.mp3") file(song) but I feel a part of it sounds good as a ring tone for my mobile phone. I want to skip the initial music and start from the lyrics. And also cut the song and make it smaller.

The below command does it.
dd if="041-oru maalai.mp3" of="041-oru maalai_small.mp3" count=6000 skip=900

count says how many blocks to copy.
skip says how many blocks to skip form the beginning of the file.
see man page for block sizes.

now "041-oru maalai_small.mp3" is what I need.

Given this, you can do a lot of stuff.
Possibilities are limited only by your imagination.
for example, you can clip a few file and cat them to form a single music file... WOW!

Friday, May 30, 2008

Backup your installation using simple tools (dd, partimage)

recently I came to know about very simple but useful tool 'dd' which can be used to a lot of amazing stuff. Here is an anazing tutorial

there is a project called partimage, that is specifically meant for backing up and restoring your partitions.
partimage home - http://www.partimage.org/Main_Page
backup drive using ubuntu live cd - http://www.psychocats.net/ubuntu/partimage

Now, I have backed my ubuntu and windows installations...

Monday, May 26, 2008

unit test code coverage using gcov

You can get a detailed and useful report on code coverage of your unit tests using the tool gcov.
It is very simple to setup and use.

useful links:
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gcc/gcov.html
http://gcc.gnu.org/onlinedocs/gcc-3.1.1/gcc/Gcov.html

Friday, May 23, 2008

list files in .rpm package file

You may want to list the files that will be installed by an rpm package
rpm -qlp will do it.

Monday, May 5, 2008

partition using gparted on ubuntu live cd

When you buy a laptop, you mostly get it with windows installed. (Monopoly you see...;) ) . So if you want to install Linux without loosing the existing windows, then you have to resize the existing partition. Well, you can do this using partition Magic. But when I tried, I kept getting one error consistently, it looked something like this: " error 1161 bad system file name" .

what next?

Ubuntu Live CD has a tool called gparted which can be used to do this.
If the disk does not have bad sectors, you can simply resize by dragging the slider in gparted.
I had to use ntfsresize first to resize the ntfs filesystem before using gparted to resize the partition.
So boot the live CD. run ntfsresize to resize your filesystem, use gparted to resize your partition.
you can as well create other partitions to install linux here itself.

The resizing is a bit tricky. You need to first resize filesystem using "ntfsresize" and then the partition with gparted. So search the web and find the right instructions to do this

useful link...
http://www.nishants.net/articles/ntfsresize.htm

New ubuntu installation with all softwares from a previous installation

I am using ubuntu Gutsy on my (office)desktop. Recently got a Lenovo T61 at office. Now I want all packages that I installed on my desktop ( which I installed as and when I needed ) to be installed on laptop also. So here is how I did it (by googling of course).

Get the list of all packages installed on your machine using this command:
$ dpkg --get-selections > sw.list

on new machine:
copy sw.list first. Then use following commands to install all these packages.

$ cat sw.list | sudo dpkg --set-selections
$ dselect

Links on internet:
http://ubuntuforums.org/showthread.php?t=261366
http://www.cyberciti.biz/tips/linux-get-list-installed-software-reinstallation-restore.html

Tuesday, June 12, 2007

burn cd in linux

mkisofs -o cd.iso ./test_dir
cdrecord -v speed=4 dev=1,0,0 -data belenix0.6.iso