Tuesday, June 17, 2008

Weird sudo situation

Recently, I hit a weird situation where i had use sudo.
I wanted to do the following with privileges

$ sudo echo 1 > /proc/sys/kernel/panic_on_oops

The above is what anyone will try, which didn't work because it sudoes "echo 1"
not the redirection ">"

The solution is
$ sudo sh -c "echo 1 > /proc/sys/kernel/panic_on_oops"

So we create a new sudo shell and -c tells the shell to execute the command mentioned in
the string.

Monday, June 16, 2008

Removing trailing whitespaces

Removing white spaces entirely from a large file can always be a pain.
Here is a simple sed command (inside vim ) that removes it in one shot

:%s/[ ^I]*$//g

NOTE: The ^I is a special character, and is generated by pressing the TAB key

vim+sed scripts to conform a file to coding standards

I have created sed scripts (that run within vim) which can fix up your source code file to conform to coding-style of the kernel.

This one adds space after every comma:
:%s/,\([^ ]\)/, \1/g

This one adds space before and after every +=,==
:%s/\([^ ]*\)\([+=]\+=\)\([^ ]*\)/\1 \2 \3/g

Stay tuned for more!

Saturday, June 14, 2008

Unix Dilbert!!! Just For Fun

Friday, June 13, 2008

Converting DVD9 to DVD5 In Linux

Iam a big movie freak. I have loads of dvd's that i share with friends. The Problem is, more often than not the dvd's tend to get scratched. So i decided that i will make a copy of all my dvd's and will share that backup copy thereby reducing the risk of my dvd's getting scratched. In india we have DVD5's (4.7 GB) available quite easily. But most of the dvd's we buy today are DVD9 format. I was on a lookout for the best tool to do the job. In windows there is a funky application called dvdshrink. On linux i found that dvdshrink does run well on wine. Iam a linux purist so i was not happy with that solution. I stumbled upon this neat application called k9copy. Its a KDE app and works absolutely well. I have not really dug into this app as it has numerous settings. For most of us the default should be good to go.
The next step is to back up the dvd. Pop in the dvd you wish to backup and watch the application read all the titles and display them as shown below.

Here one can select/deselect title set. Remember if you are not de-selecting any title set then your most likely to have the full dvd converted to DVD 5 format but at the cost of picture quality.
That it!! Now click on "Copy".

It creates you a lovely iso image that you can later burn or you can also directly burn into a dvd on the fly.

Word Of Caution : I found that this app crashes when trying to rip from rc2 protected dvd drives. The only way to get rid of the problem is to use rc1 drives. If not you need to search on the net for rc1 firmware for your drive to crack it :-)

Playing With Scribefire

This is just a mock post, playing around with scribefire. It looks awesome, lets see what it can do? My buddy chirag suggested me this.