Monday, April 2, 2007

Using abbrevation in VIM

Here is a vim tip:

use abbreviate to something you type very frequently

:abb perl #!/usr/local/bin/perl

Now in insert mode as soon as you press space after typing perl, the #!/usr/local/bin/perl will be typed automatically for you.

if you don't want it to type, type something like "perls ", and then go back and remove the "s"!

Put this in your .exrc file for convenience

Sunday, April 1, 2007

Using Samba

Yes, it is possible!

Want to access a Windows machine from Linux?
Here is what you do to that (samba)

First of all, I assume that the two machines are somehow connected to each other. I have both of them connected to my home router.

Install samba, start samba, share the folder on windows - use your favorite browser to browse your files

Okay, here is little more details

On the Windows machine
  • Open a Windows Explorer
  • Right click on the folder you want to share
  • Click on "Sharing and Security"
  • A Properties window pops up, clock on the "Sharing" Tab
  • Check the checkbox "Share this folder on the network" (and "Allow network users to change my files", if you wish) in the "Network sharing and security" section
  • Apply and close the window
  • Make a note of the IP address of the interface that is connected to the network (say 192.168.100.100)

On the Linux machine
  • Samba was already loaded on my Linux machine (I think you can use any of rug/yum/apt-get/YaST to install samba)
  • Start the samba service (may have to login as root or use sudo)
#> /etc/init.d/smb start
  • Now open any of the web browsers (firefox/konqueror) and type smb://192.168.100.100/ in the address bar

You should now be able to see all the files in the folder you are sharing on you web browser.

Saturday, March 24, 2007

Using perl's File::Find

Perl's File::Find module


What does it do? What I understood

Use the find OR finddepth methods after "use"ing File::File;

find (\&wanted, '/path/name/');

This goes to all the directories in the "/path/name/" find all the files. In the subroutine select the required file.

for example
find (wanted=>sub{print $_;} '/path/name');
would print all files in /path/name/

Friday, March 23, 2007

Using Unzip in *nix

unzip on *nix Howto -

Displays what is in the zip file

#> unzip -Z zipFile.zip

Unzips all files to the current directory

#> unzip zipFile.zip

Unzips only File1 and File2 from the zipFile.zip

#> unzip zipFile.zip File1 File2

Unzips File1 to newDir/File1

#> unzip -d newDir zipFile.zip File1


Wednesday, March 21, 2007

Command line CD ripping on Linux

Comamnd line CD Ripping on Linux (Kubuntu 6.10)

#> cdparnoia -vsQ
lists all the tracks

#> cdparnoia 1-10
rips tracks from 1 to 10

#> cdparanoia -B -Z
(rips all no data check is done, seems to be much faster with old, broken CDs!)

----

(assume bash)

#> apt-get install vorbis-tools

#> oggenc -o track01.cdda.ogg track01.cdda.wav

#> foreach fle in *wav; do oggenc -o $fle.ogg $fle; done

Tuesday, March 20, 2007

Using ndiswrapper

How to make wireless work

Download the ndiswrapper, install it

Download the Win-XP driver and unzip into a directory

go to the directory where the driver is located

(use sudo if required)

#> ndiswrapper -i dirver.inf

#> modprobe ndiswrapper