Wednesday, January 21, 2009

Technical

Makefile
cp a b . ; \
cp c . ;

The \ indicates that both the cp are to be done on the same shell, that is they will be inclusive. But if I remove the '\' the cp commands will be exclusive. They will be executed with a break in continuity.

BASH
Searching and changing permission of files and folders

FILE
find . -name "*" -type f -exec chmod 444 {} \; -print

DIR
find . -name "*" -type d -exec chmod 555 {} \; -print

SCP
All of us have faced this problem one time or the other. We do a scp, and midway through the process scp feels knotty(naughty). The solution is rsync. To resume a partially scp-ed file we use rsync.

THE PROBLEM
$> scp anjan@server1:/a/b/xyz
95% complete
Connection timed out :-(

THE SOLUTION
$> rsync --partial --progress anjan@server1:/a/b/xyz

VIM Tip

1. There are lots of other neat things you can do with block selects. Here is a way of adding a string to the end of each line, like so:

i. Press Ctrl+V and then j to extend the selection to all the lines you want.

ii. Press $. This will create a 'ragged edge' selection that extends to the right end of each line in your selection.

iii. Press A. I inserts text at the beginning of a block selection, A appends text at the end of a block selection.

iiii. Type your text and press Esc.

2. To search for ':' and remove everything in the line after that
:%s/:.*$//gc

3. All words are jumbled in one line. The must be put in separate lines...
:%s/\ /\r/g (search blanks and replace with return; globally)

4. map = j$?\/d$

PERL
To chk if the process whose pid is known is alive or dead

#! /usr/bin/perl
$exists = kill 0, $PID ;
if ($exists) {print "YES\n";} else {print "NO\n";}

Friday, January 2, 2009

Lets plan a trip and skip the meet

To travel hopefully is a better thing than to arrive.
-R.L. Stevenson

So aptly said but not so widely appreciated. A new year has dawned upon us. Old and new calenders have changed places. Till yesterday what decked our desks has now been relegated to the bin. Give the new a chance is what seems to be the mantra. These were the thoughts when I woke up in the morning. I immediately left my bed and went to the living room. Subhro was already up and he was already looking at the new calender. In many things our frequencies match.

Turn turn sift sift...yes here is the holidays list. "Wow, so many 4 day weeks this year". I said, "look 26th Jan is a Monday".
"Why not plan something?"

"Plan what", came the instant retort from Subhro.


"Plan anything you fool."


"So be it if you insist. Let's wake up early", quipped Subhro in all seriousness, "and catch the live telecast from
Rajpath from the very beginning. I never seen it from the beginning. Ages ago when I was 5-6 my mom once pulled me out of the bed early; I was all groggy and very annoyed and..."

"Ah cut the crap. Someone please do something with this fellow. Well what can I say, other than curse my luck to be talking to you".


"What do you mean? You yourself asked me to plan something and I did. God! if I do I am damned, if I do not then also I am damned" said Subhro in a mocking anger. He knows very well how to annoy me.


"It was not your fault, planning, thinking, contemplating, I should not associate these words with you".


This is our general lingo. Nobody takes offense. But the other person always waits for the chance to give back in the same coin as soon as possible.


"I was thinking of a trip." I said.


"Great. As a matter of fact I was also thinking about it. I have shortlisted on either Goa or Pondicherry". "Both places are very similar yet very distinct too".

That's the fun part with Subhro my room mate and in many ways my alter-ego. We can think alike.


"Exactly my thought". I have already thought of these two places with a bit of a tilt towards Pondicherry. I told this to Subhro and it seemed he also agreed to it.


I am not the bag packer type tourist who just has to pick the sack and start the journey. I love to plan and plan hard. More than the tour it's the planning which fills me with joy and excitement. Many don't agree though.


"So how are we going". "Car or bus or train may be. If we are going to Goa then car is not a very good option. so we need to fix on the place".


"The weekend is Friday 23rd, Sat 24th, Sun 25th and finally 26th Monday. Pondi takes 8hrs, we start
earliest morning at around 4:00. We can take Bangalore-Krishnagiri-Chennai-Pondicherry route or the Chennai route but that will add some extra Kms. I heard that Chennai route is good so many people take it. We need to find someone who has been there rcently". Subhro continued, "10hrs is my estimate. So ideally we should be there by 2:00pm unless we plan to stop at Gingee Fort. So anyway we can be there by 6pm". "We can make a booking in the Aurobindo Ashram"

"We can not take accomodation in the Ashram, remember. No late nights no
Khamba".

Suddenly Subhro jumped off the chair. It's already 8 and today is not a holiday.


"Do some more reserach. We have to chalk out the trip ASAP. Oh yeah today you have your client call so don't be late on first day..." and saying this Subhro marched into the bathroom.


He had his revenge.