Wednesday, March 28, 2007

Ctags not enough? Try Cscope

If you don't know what ctags is, you should read this.

If you are using ctags and are comfortable with it, but looking for something a bit more refined and powerful, you should be using cscope. It is very similar to ctags, except the ctrl-[ button is now replaced with ctrl-\ with many options to go to variable declarations, definitions, etc.

An excellent, but simple tutorial can be found here.

Tuesday, March 27, 2007

Quick Intro to Crontab

This is another *nix power tool that is a must use. Scheduling jobs with crontab is so trivially easy.

Type
crontab -e
on your command prompt

This should bring up a window looking like this:

# m h dom mon dow command

Its stands for m-minute, h-hour of day (24 hr fmt), day of month, month, day of week, command.

Thus if my crontab looks like
# m h dom mon dow command
30 3 * * * rm -rf *

It tells it to run "rm -rf * " (Jeez! I am kidding, DON'T PUT THIS in your crontab) at 3.30 AM every day...

If I wanted to run the job say twice every day, I would put in
30 3,13 * * * rm -rf *
which will run the job at 330 AM and 130 PM.

That's it!

Monday, March 26, 2007

Execute across all windows in gnu screen

screen is one of the coolest underrated unix utility. If you have not heard of it, or don't know enough about it, check out the excellent intro here. The tutorial is meant for Gentoo Linux, but is general enough for all *nix distro.

One of the things missing in the tutorial is, if after working in screen for a while, if you want to send a command to all windows, say a new export DISPLAY command, how to go about it.

Simple:

Press Ctrl-A :
The screen command window should be highlighted at the bottom.
At the ":" prompt, type
at "#" stuff "export DISPLAY=localhost:0.0\015"

That is all! The \015 is used if you don't want to go through the pain of pressing enter at each of the windows...if you would rather press enter manually, just take that off. If you look at the command, you see that "#" can be pretty much replaced with window numbers to execute commands at only certain windows. You will have to dig into manuals for more info....

Left handed mouse without getting left-handed compliments?

How do you get your mouse pointers reversed in *nix?

The solution - type

xmodmap -e "pointer 3 2 1"

to reverse your mouse. That's all. Getting errors like the following?


xmodmap: commandline:1: bad number of buttons, must have 9 instead of 3
xmodmap: 1 error encountered, aborting.

Change your command to:

xmodmap -e "pointer 3 2 1 4 5 6 7 8 9"

If it expects 5 buttons, just write "3 2 1 4 5" after pointer....