user-avatar
Today is Thursday
November 28, 2024

August 6, 2010

July 4, 2010

Shell script to search for a type of file in a directory recursively and copy it in a destination

by viggy — Categories: shell — Tags: , , Leave a comment

I had used wget and downloaded all the java videos from the java tutorial site( and also all the other files on the website). There were around 20 of them. The problem was that the lectures were each present in a separate folder and I had to traverse to each of them to watch them. So I thought of writing a script which would search the main directory recursively for the lectures and then copy it in a specific folder. Luckily in my case each of the lecture were named differently and hence I didnt have to rename them and there were no issues of file name getting clashed. Below is my shell program:

#!/bin/sh

list=$`find . -type f | grep ".mp4"`
cp $list ./lectures

This would search all the files which had .mp4 in their name and copy them into the folder lectures.

June 24, 2010

GPG key error while doing apt-get update

by viggy — Categories: ubuntu — Tags: , , , 2 Comments

I had entered a new repository path in my sources.list file and hence I did

sudo apt-get update

However I got the following error:

W: GPG error: http://hudson.gotdns.com binary/ Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 9B7D32F2D50582E6
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 10975893E549B1AC

When I looked for a solution on internet, I found the following solution to add the gpg key in my system.

NOTE: This can only be done by a root user, hence in Ubuntu, u will have to do sudo su before executing these commands.

root@vignesh-laptop:gpg --keyserver pgpkeys.mit.edu --recv-key 9B7D32F2D50582E6
gpg: requesting key E549B1AC from hkp server pgpkeys.mit.edu
gpg: key E549B1AC: public key "Launchpad yorba" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)

This will request key from the server mentioned in –keyserver and display whose public key it is.

After this execute the following command. This will store the the gpg key in your system as a trusted gpg.

root@vignesh-laptop:/home/vignesh# gpg --armor --export 10975893E549B1AC | apt-key add -
OK

Now do
sudo apt-get update
to successfully update from the newly added repositories.

June 17, 2010

recording feature of vim

by viggy — Categories: linux, tech, ubuntu — Tags: , 2 Comments

Good article on recording feature of vim can be found in the link given below.

http://www.thegeekstuff.com/2009/01/vi-and-vim-macro-tutorial-how-to-record-and-play/

June 13, 2010

Rajneeti-Impressed but could have been better

by viggy — Categories: experience, Fun — Tags: , , Leave a comment

After hearing mixed response from people about Rajneeti, I finally found some time to watch it. Though I hardly watch any hindi movies until I hear very good reviews about it, since this was about politics, I wanted to watch it. Strangely Politics and Underworld plots are the only movies that I like to watch in bollywood. Anyways so when I finally sat to watch the movie, I knew from the start that I had like it.
Overall I actually liked the plot. Story was very well written. The script had many instances taken from GODFATHER, like the one in which driver plants the bomb and runs away, keeping a dead body on the bed to threaten a person and also that a foreign returned son has to stay back as his father has been attacked . But many other instances were quite original and i liked it. Even those picked from GODFATHER were very well utilized and credit should be given to the script writer for that.
Characters for the film also was very well chosen and though there were big names in the movie, it was clearly not just to attract their fan followers. Ranbir again impressed me with his acting. Ajay and Nana have always done justice to such type of roles and this was nothing new for them. Among the characters, I was disappointed by the small role given to Naseeruddin Shah. He could definitely be utilized in a much better way. Also Nikhila Trikha, who played the role of Samar’s (Ranbir) mother did not do justice to her role. Especially,in the scene where she goes and talks to Suraj(Ajay Devgan), I could see nothing from her side in the scene. Though that scene had a very small significance in the overall story, but still that scene required much more from her. Why she was selected for the role still mystifies me but a explanation can be found here.

Throughout the story one point is very clear, Mango Man is a complete fool. With all the political drama happening around, Suraj, who was supposed to be representing the Mango Man clearly also becomes a politician and forgets his being a Mango Man. His roots being a Mango Man is again shown at the end where he does not join the side of Samar even when he is offered the highest seat. Also when Katrina comes forward and cries for the injustice done to her, Mango Man supports her and makes her win the election without realizing whether she is the right person for being a CM or whether she will be able to run the government for next 5 years. This is very much true in real life and I guess that is the main idea that Rajneeti wants to spread. Even though this is a democratic country, only members from the so called royal family are chosen as the right person for the royal seats. Also between the fight for seat in the royal family, it is the Mango Man who suffers but still supports the royal family. This can be clearly seen in Maharastra where the fight inside the Thackeray family is clearly the main reason for dividing Mumbai as a city for Maharastrians and not for Biharis.

May 21, 2010

how to configure proxy for apt-get?

by viggy — Categories: linux, tech, ubuntu — Tags: , , , , , Leave a comment

To configure proxy settings for apt-get or aptitude or synaptic manager, all you have to do is edit the file, /etc/apt/apt.conf .

Here you have to mention the following 3 lines::

vignesh@vignesh-laptop:~$ cat /etc/apt/apt.conf
Acquire::http::proxy “http://username:password@host:port”;
Acquire::ftp::proxy “ftp://username:password@host:port”;
Acquire::https::proxy “https://username:password@host:port”;

Once you have made the above changes in /etc/apt/apt.conf , you will be able to use apt-get, aptitude or your synaptic manager through the proxy.

April 14, 2010

FOSS for budding developers workshop

by viggy — Categories: linux, tech — Tags: , , , , , 1 Comment

Last weekend, CMRIT GLUG along with IBM and FSMK conducted a 2 day workshop, “FOSS for Budding Developers”. This workshop was completely technical in nature and among the many FOSS workshops that I have attended, one of the most useful one for me. The professionalism of IBMers could be seen during the workshop which was also the main reason for the huge success of this workshop.

The workshop covered the following topics,
Day 1

  • Linux Kernel Developement
  • Eclipse IDE and how to develop plugins in it
  • Day 2

  • Linux Test Project
  • Apache web server and developing applications in it.
  • OpenPegasus
  • I was interested in Linux Kernel Developement and the Linux Test Project sessions. I had taken my laptop to make the best use of the workshop.

    I have been using GNU/Linux since last 2 years, but never did I get the courage to compile and build the Linux kernel. Only around 6 months back, I had for the first time with help of Naresh, installed the new linux kernel on my system using apt-get. The main reason for not trying out building my own linux kernel was that I was afraid that I would loose all the data I had in my system. However for the workshop I had decided that I will try it out. So when the Linux Kernel session started, I was very excited.
    In the pre-lunch session, we were introduced to various tools that any Hacker would require while trying to read the source code or build from source code. We were introduced to gcc, gdb, make, makefiles, strace,ltrace and cscope tools. Though I knew little about gcc and gdb, I realized the importance of the other tools. I particularly was marveled by “cscope” and “strace”. Optimized use of cscope will surely decrease the time taken to go through the source code for any developer. I remember it had taken me around 2 months just to go through the Evolution source code. If I had used cscope then, it would hardly take me 2-3 days for the same. We were given a very brief introduction to cscope during the session, but I will learn more about it myself and write about it in the near future.
    The pre-lunch session thus prepared the ground for us to venture in to building the linux kernel.

    Post-lunch we started with Building the Linux Kernel 2.6.33.2 version. I was amazed by the simplicity involved in building the kernel. It is just a 7 step procedure, if you are building the kernel for your own desktop or laptop.

    It took around half an hour to execute. After this I just need to update my grub if it has not been done by the above steps already. Just confirm it by having a look at /boot/grub/grub.cfg. If the new kernel lines are added then you are ready to Reboot and use the new kernel which was just built.
    Thats all.

    After booting into the new kernel, we started writing simple codes for new kernel modules and drivers. Again the simplicity of writing a new module or driver and loading it amazed me. However a lot more has to be explored and I will definitely try them in future.

    On day 2, I attended the Linux Testing Project workshop. It was again wonderfully planned by the IBM team. We were first given a brief introduction to the history and importance of the Linux Testing Project with the team making it very clear that the testing cycle is as important as the development cycle. After this we had a hands on session.

    In the hands on session, we started with building the Linux Testing Project in our systems. Than the IBM team had come with some tasks for us. We were asked to run a test case which was written such that it fails intentionally. This was done so that we could study the test case and come up with a solution as to why that particular test case was failing. I had teamed up with Saket and together we were very close to finding the solution. It was quite fun and really a good Hacker workshop.

    There were many interesting points that we noted while trying the Linux Testing Project. One among them was, I was using Linux Kernel 2.6.31.x where as Saket was using Linux Kernel 2.6.33.2. So when we executed the Containers Testcases on our systems we found that some test passed successfully in my system but failed in Saket’s system. This clearly showed us that Linux Kernel 2.6.33.2 had some bugs. We did not dig into the matter due to lack of time. However I need to check it soon.
    I have skipped lot of technical details here as I will give the technical details later when I try it again myself.

    April 13, 2010

    Use ALT-TAB for VNC machine on Linux

    by viggy — Categories: linux, tech — Tags: , , , Leave a comment

    This is for those who work usually on systems through VNC, I am one among them. It was very cumbersome for me to select tabs in the VNC system using mouse and not able to use ALT-TAB functionality. Hence when I searched in Google for any solution, I found a very simple soultion.

    Just change the ALT-TAB key binding in your linux machine to something comfortable for you. After you have done this, whenever you select ALT-TAB, the system passes that key-binding to the VNC window.

    The solution is just that simple. :). Enjoy.

    April 7, 2010

    How to enable Wireless on CentOS?

    by viggy — Categories: tech — Tags: , , , , 1 Comment

    Well since CentOS, in the name of stability never has any latest package installed, it is very difficult to do small things in it which is a matter of few clicks in some other distributions like Fedora or Ubuntu.

    However since I had CentOS installed on my laptop, I had to find a way to get my wireless up. So I started searching different ways to do it. First I had to get the system to detect my wireless. For this I followed the wiki given in CentOS, http://wiki.centos.org/HowTos/Laptops/Wireless#head-d0f09f4e13e1089355527862718bbf7548a5a64a

    After this I installed latest wireless-tools package which I downloaded from here, http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html

    Then I started my wireless using the following command,
    ifconfig wlan0 up

    After this I tried to find the available wireless connections which I could connect to. This can be obtained by the following command.
    iwlist scan

    After I found the wireless connection which I used to connect usually, I checked its features. However in CentOS did not give any option for me to enter the configuration in its wireless configuration.

    Hence after digging in internet for quite some time, I found out that I need to install wpa-supplicant package . So I downloaded the package and installed it as given in its install file.

    After that I needed to put the wireless configuration in the wpa-supplicant.conf file. Luckily I had saved the configuration details that I used in Ubuntu. This I used along with trial and error method to get the right configuration.

    You can get the explanation for each variable using “man wpa-supplicant.conf”. Following is the content of my wpa-supplicant.conf file.
    ctrl_interface=/var/run/wpa_supplicant
    ctrl_interface_group=wheel

    network={
    ssid=”ABCDEF”
    key_mgmt=WPA-EAP
    eap=PEAP
    identity=”abc@xyz.com”
    password=”password”
    phase2=”MSCHAPV2″
    }

    Once wpa-supplicant.conf is configured, start wpa-supplicant connection using the following command:
    wpa_supplicant -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -d

    Voila. Now you have your wireless connection detected and working properly. Enjoy.

    March 24, 2010

    Custom icons to your script

    by viggy — Categories: tech — Tags: , , , Leave a comment

    I have to use VNC many times for my work. Everytime to invoke vncviewer, I had to press -F2 and then type “vncviewer”. I didnt want to do this and hence I thought I will write a simple shell script which I can use to run whenever I needed vncviewer. Hence I wrote following two lines in a shell script.

    #!/bin/bash
    vncviewer

    This I saved on my desktop and used to double click it whenever I needed to run it. However even this used to ask me if I wanted to run it or display it. Also the script had a default icon which I didnt want and wanted it to have the icon of vnc. Also I didnt like it to occupy my desktop area and wanted to keep it on my panel. Hence i searched on google for answers. i found the following mail which gave me a clear idea of how to do it.

    http://linux.derkeiler.com/Mailing-Lists/KDE/2009-04/msg00131.html

    You can create your own icons by creating a textfile and giving it a .desktop
    extension. That’s all an icon is. Go to /usr/share/applications and have a look.
    Anyone of those files can be dragged into you ~/Desktop folder if you use that for
    desktop icons or else directly onto your desktop.

    The format of the .desktop file is fairly simple to follow I have made them for
    url as well as script icons and keep them in /usr/local/share/applications. Once
    you have created the file the “icon” can be used like any other icon, e.g. adding
    to Quicklaunch. Use anything for an icon. Here is what one of mine looks like.

    [root@localhost ~]# cat /usr/local/share/vncviewer.desktop
    [Desktop Entry]
    Name=Vncviewer
    Comment = runs vncviewer script
    Exec=/usr/local/bin/vncviewer.sh
    Icon=/usr/share/icons/vncviewer.jpeg
    Terminal=0
    Type=Application
    Categories=Application;Internet;

    Hence now I could drag this icon on my panel and launch vncviewer in just one click.
    :)