Posts Tagged ‘Tips’

Setting up a Debian repo in LAN

It was really a nice experience going to MES College Of Engineering, Kuttippuram last week to attend Debian Mini Conf 2011. Met friends, made new friendships and learned many new things from there. Thanks to Jishnu ettan, for giving me a 50GB Debian repo that contains all the packages of squeeze of both i686 and amd64 architectures. Today, I will explain how to set up a Debian repo (squeeze) so that it be can shared over LAN.

First, run terminal and switch to root user.


If you have the repo as an ISO image file, we need to mount it to a directory. The following command does that:

#mount <path-to-iso> <path-to-mount> -o loop

Edit /etc/apt/source.lst and add the repo we mounted. Append the following line to the file:

deb file:///<mounted-path> squeeze main

Update the package list:

#apt-get update

We are going to share the files using http, hence we need a webserver. To install apache:

#apt-get install apache2

Make a symbolic link of <mounted-path> in /var/www

#ln -s /var/www/repo <mounted-path>

Done! Now add this machine as a repository in other Debian systems in LAN, edit /etc/apt/source.lst to:

deb http://<ip-of-server>/repo squeeze main

The same can be done using a FTP server. All you have to do is to make the symbolic link in FTP’s configured path and use ftp:// instead of http:// in /etc/apt/source.lst. Thank you 🙂

Python Script to fix VBR errors of mp3 files in a directory, recursively

February 19, 2011 8 comments

If the seek bar of your rhythmbox is not working with some mp3 files, it might be an issue with Variable Bit Rate of them. The tool, ‘vbrfix’ written by William Pye solves the issue, but the problem is that it doesn’t have an option to search for files recursively. Here is a small python script that gets the paths of multiple mp3 files recursively and give them as arguments to vbrfix tool. Make sure you install vbrfix (from the software repo) before running the script.

Please see comments for a better, 1 line substitute to do the same. Thanks to Rajeesh ettan and Syam ettan 🙂

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#       Copyright 2011 Ershad K <>     
#       Usage: python
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later version.
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       GNU General Public License for more details.
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.

import sys
import os

quote = '"'
folder = sys.argv[1]
find_command = "find " + folder
find_command += " > mp3files_list"

os.system("sed 1d mp3files_list > mp3files_list1");

f = open("mp3files_list1", 'r')
for line in f:
    line = line[:len(line)-1]
    command = "vbrfix -always "
    command += quote + line + quote
    command += " " + quote + line + quote
    print command

os.system("rm mp3files_list mp3files_list1")

Improvements to code and suggestions are always welcome, Happy Hacking 🙂

How to download .deb packages for offline installation

Some of my friends always complain that they are not able download packages due to Internet availability issues or usage limit. Most of them are using different Ubuntu versions, hence I cannot use APTonCD to download the packages for them. Here’s a small solution for this, Thanks to ilug-tvm and Rajeesh ettan.

Step 1: Get the download URLs in a file :

Execute the following command replacing package-names with required ones, separating by a space.

$apt-get -y install --print-uris package-name | cut -d\' -f2 | grep http:// > apturls

Step 2: Copy this file (apturls) to a machine which has high-speed Internet access, and execute the following command to download the packages:

$wget -i path-to-apturls-file

Step 3: Now get those downloaded packages to your machine, and install them using :

$cd path-to-the-downloaded-packages-directory

$sudo dpkg -i *.deb


Thank you, Good Luck 🙂

Irssi notification in terminal using ‘write command’

In Desktop Environments like KDE or GNOME, we have special libraries like knotify or libnotify to display notifications from various applications. Some applications like Konversation has its own notification systems. But what about command line tools like Irssi? Imagine you are chatting in tty1 using irssi and doing something in tty2.How will you know if someone has mentioned you nick in channel message? Well, here is a small solution for this.

Luke Macken has written a wonderful  perl script to display notifications using notify-send command in desktop environments. Thanks to open source, I tweaked the call to notify-send command to suit our tty-notification. All that you have to do is this :

Step 1 : Get the Script and write it to a file ‘’.

Step 2 : Replace

system(“notify-send -i gtk-dialog-info -t 5000 ‘$dest->{target}’ ‘$stripped'”);


system(“echo ‘$dest->{target}’ ‘$stripped’ | write <Your username>”);

Make sure you replace <Your username> with your system username.

Step 3 : Put it in ~/.irssi/scripts/ directory.

Step 4 : Execute the following commands in irssi:

/load perl
/script load notify

Done, you will get notification to the latest tty to which you are logged in!
Good luck 🙂

PS: The notification that you get is not eye-candy, please adjust for it now 🙂

How to connect BSNL Clarity in ubuntu 9.04 ?

Though we have many tools to connect BSNL Clarity in Linux Systems, unfortunately they don’t work in ubuntu 9.04 and in other lastest OS’. Here, i will explain how to get connected with BSNL clarity in ubuntu 9.04.

First, you need to edit the grub and add a line to ubuntu’s kernel. Follow the steps to do that:

sudo gedit /boot/grub/menu.lst

Modify the ubuntu’s boot configuration to like this :

title        Ubuntu 9.04
uuid        b744ea84-c1b7-4519-9223-3bb99103d42f
kernel        /boot/vmlinuz-2.6.28-11-generic root=UUID=b744ea84-c1b7-4519-9223-3bb99103d42f ro quiet splash usbserial.vendor=0x15eb usbserial.product=0x0001
initrd        /boot/initrd.img-2.6.28-11-generic

I simply added  ‘usbserial.vendor=0x15eb usbserial.product=0x0001′ to the kernel.

Next step is to install wvdial. Since the ubuntu 9.04 CD edition doesn’t have wvdial by default, we need to install it manually. Follow the steps to install it :

1. Download this file

2. Extract it in your home directory

3. Give the following commands in terminal

cd wvidal

sudo dpkg -i *.deb

4. Restart the computer

It’s done ! Now you can browse like the older versions of ubuntu by executing Mr.Dipin Krishna’s executable (./bsnlclarity in terminal after copying it in your home directory) . You can get it here. Good Luck 🙂

Categories: Experiments Tags: , , , ,