Archive for January, 2008

Change MP3′s ID3 tag using Kid3

Written on January 10th, 2008 by shakir
Categories: Nerd Public Journal?

If previously I’ve been posting about changing file’s name based on it’s metainfo, this time I’m gonna talk about the opposite, specifically in changing MP3′s ID3 tag using Kid3.

The package is installable in Ubuntu / Debian;

shakir@gutsy ~ $ sudo apt-get install kid3

After launching the program, add files that we want to change their ID3′s, and click on From Filename

and that’s just it :D

Easy SSH tunnel with gSTM

Written on January 10th, 2008 by shakir
Categories: Information Insemination

At one time we might need to bypass the firewall, and at another time we might need to secure / encrypt our connection, and for that we normally set up tunnel in SSH. Setting up tunnel itself is fairly easy, yet there are programs  to make it even easier.

I’ve previously been introduced to gSTM (Gnome SSH Tunnel Manager) and I must say it’s a very helpful program. Here’s a one liner to install it Ubuntu / Debian;

shakir@gutsy ~ $ sudo apt-get install gstm

Just for an example, I’ll show how to tunnel port 80 (HTTP) of one of my other Linux box (under VMWare of course);

Let’s first create a tunnel

and login..

Edit how to redirect the remote box’s HTTP port

and test it out..

It works!  :D

 

Batch rename files with Krename

Written on January 9th, 2008 by shakir
Categories: Information Insemination

When I was previously recovering lost files of my home folder, I wrote scripts to automatically rename recovered files based on their meta info so that I don’t need to go through them one by one. That worked for me at that time, but I must say it was quite a tedious exercise, as there were so many file types that I need to deal with. That all changed when I found myself krename, a Qt based batch file rename program.

It’s available for Debian / Ubuntu and installable via this command:

shakir@herugrim ~ $ sudo apt-get install krename

Using it is as simple as adding files to the application’s workspace, and here I’ll show an example on how to rename JPEG files.

Upon clicking Functions on the Filename tab, you’ll be presented with this screen:

and you’ll get the next screen upon selecting JPEG EXIF Info.

Add whatever EXIF Info that you would like to rename your files to, click Finish, and you’re done..

Set up dual monitor in Linux

Written on January 7th, 2008 by shakir
Categories: Information Insemination

I’ve just bought ViewSonic VA2226w from Lowyat, and has been able to use it in dual monitor mode with my XPS M1330 (nvidia based) and Kubuntu. The ViewSonic that I bought is a 22" LCD monitor with resolutions up to 1680×1050 (only just as high as my 15.2" Inspiron 6000′s screen)..

I was using nvidia-config to configure the dual display, and after some trial and error, I come out with this /etc/X11/xorg.conf file:

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" RightOf "Screen1"
    Screen      1  "Screen1" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
    RgbPath         "/usr/X11R6/lib/X11/rgb"
    FontPath        "unix/:7100"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
EndSection

Section "ServerFlags"
    Option         "Xinerama" "1"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor1"
    VendorName     "Unknown"
    ModelName      "LCD"
    HorizSync       30.0 - 75.0
    VertRefresh     60.0
    Option         "DPMS"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "ViewSonic VA2226w"
    HorizSync       30.0 - 82.0
    VertRefresh     50.0 - 75.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Videocard0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 8400M GS"
    BusID          "PCI:1:0:0"
    Screen          0
EndSection

Section "Device"
    Identifier     "Videocard1"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce 8400M GS"
    BusID          "PCI:1:0:0"
    Screen          1
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Videocard0"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "metamodes" "DFP: 1280x800 +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Videocard1"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "metamodes" "CRT: nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

and here’s my work desk at home (after some clean up :) )

 

p/s: Hope nobody mind me using the Microsoft keyboard and mouse set :D

Recover lost / corrupted GRUB (MBR) entry

Written on January 4th, 2008 by shakir
Categories: Information Insemination

Often time the Master Boot Record (MBR) is also lost / corrupted when the we’re having problem with the partition table, and so here I extend my previous post on recovering lost partition table using the Ubuntu Live CD.

First of all, let’s mount the related stuff;

ubuntu@ubuntu:~$ sudo mount -o ro /dev/sda1 /media/
ubuntu@ubuntu:~$ sudo mount -o bind /dev/ /media/dev/
ubuntu@ubuntu:~$ sudo mount -o bind /proc/ /media/proc/

and then chroot

ubuntu@ubuntu:~$ sudo chroot /media/

Once we are in the chroot environment, run grub

bash:~# grub

Assuming you are installing grub on your first harddisk, and your root filesystem in the first partition of your first harddisk, your journey should be something like this;

    GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]

grub> root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/e2fs_stage1_5" exists... yes
 Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  16 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2
/boot/grub/grub.conf"... succeeded
Done.

grub> quit

Once you’re done with that, you might want to unmount whatever you have mounted before. Don’t forget to exit from the mount directory first;

ubuntu@ubuntu:~$ cd ..
ubuntu@ubuntu:~$ sudo umount /media/proc/
ubuntu@ubuntu:~$ sudo umount /media/dev/
ubuntu@ubuntu:~$ sudo umount /media

and then reboot to see if your problem is really fixed..

Recover lost partition table using Ubuntu Live CD + gpart

Written on January 3rd, 2008 by shakir
Categories: Information Insemination

My friend suddenly ask me for a Ubuntu Live CD and upon being asked he told me that he has not been able to boot his machine for getting the Operating System not found error. I’m posting here on how did I helped him out with the problem for documentation.

The program I used was gpart, and to use it in Ubuntu (Live CD) is to add Universe repository to /etc/apt/sources.list as this;

deb http://archive.ubuntu.com/ubuntu gutsy main restricted universe

and run this commands to install it.

ubuntu@ubuntu:~$ sudo apt-get update
ubuntu@ubuntu:~$ sudo apt-get install gpart

By running the next command, gpart will search the whole disk for possible partitions and write it’s findings to the partition table:

ubuntu@ubuntu:~$ sudo gpart /dev/sda -W /dev/sda

That’s it. Just reboot and see if your system is now bootable…

p/s: Other than gpart, testdisk can also be used for partition recovery, but i’m not covering it here..

Configure passwordless login in ssh

Written on January 1st, 2008 by shakir
Categories: Information Insemination

This post is just a quick recap on how to configure passwordless ssh login.

In my setting, herugrim is my local machine, and anduril is the remote machine with the ip address of 192.168.1.10

The first step is to (optionally) generate RSA key for use with SSH. Make sure you dont use any passphrase for this or you’ll later need to enter the passphrase upon login instead of password, which doesn’t really server our purpose here.

shakir@herugrim ~ $ ssh-keygen -t rsa -C shakir@192.168.1.10
Generating public/private rsa key pair.
Enter file in which to save the key (/home/shakir/.ssh/id_rsa): /home/shakir/.ssh/id_rsa.192.168.1.10
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/shakir/.ssh/id_rsa.192.168.1.10.
Your public key has been saved in /home/shakir/.ssh/id_rsa.192.168.1.10.pub.
The key fingerprint is: 11:d9:23:2e:68:05:59:d9:ac:5a:00:69:17:3a:b4:24  

Now we can copy the public key to the server. Instead of doing it manually, OpenSSH has a nice program to do just what we need:

shakir@herugrim ~ $ ssh-copy-id -i .ssh/id_rsa.192.168.1.10.pub shakir@192.168.1.10

So now lets test if our passwordless login is successful:

shakir@herugrim ~ $ ssh shakir@192.168.1.10 -i .ssh/id_rsa.192.168.1.10
shakir@anduril:~$

Great, it works :) The next thing to do is to just make sure you keep your private key safe..