Journey to Cincinnati

June 30, 2008

I just have to face it. I do not have any hard proof of my time in US. I am trying to get some photos from my friends, but it may take long time. So, I just thought of writing some memories down so that I will remember my time in US later. Here is the very first one. The travel from Mumbai to Cincinnati.

I still remember the day of my departure. It was July 15th. 2005. I was to reach the airport at 11 PM. And I had not done any packing or any shopping. I was lucky that I had Sourabh’s bike with me and if I remember it correctly, Sourabh was also with me. The day is quite a blur to me as everything was done in a haste.

I started from mumbai at 3:30 AM. It was my first time to board a plane. It was truely exciting. Specially the time when the plane takes off and lands. It is thrilling. You feel like in the roller coaster (Although I had not been on a roller-coaster either).

The flight was to go from Mumbai to Delhi, then to London and then finally to New York where I was to change the flight to reach Cincinnati. Everything was fine until the plane reached London. There came the first sign of bad luck. We were asked to get down in London (apparantly they had to search the flight for bombs). They seated us in a very small room for about 1 hour. There was no exit from this room and we were all awkwardly waiting for the chance to board the plane again. Many couldn’t even get a chair to sit. Believe me, the agony of that one hour can not be explained in words (Atleast not the words taht I can publish here!!!).

Then finally I landed in New York JFK airport. I picked up my luggage and entered the JFK. I located the Air India counter and checked my luggage so that I dont have to carry it around. After 45 mins of wandering, I found the Delta airlines counter to get the boarding pass for my flight at 6:50PM. When I reached there, I found a very long queue waiting. I was getting restless as my departure time was approaching. After about 1 and half hour of waiting in line, I finally reached the counter only to find out that my flight was cancelled…..:-(.

I asked them to see if I could catch any other flight that night. But all flights that night were full. So they booked me on a flight next morning. The only good think was that I didn’t have to pay anything extra. This was evidently a regular affair in US.

The down side was that I had to spend the night in New York. I didnt have any dollars with me. I only had the travellers checks. I went to the Foreign Exchange counter to encash my checks. But I found it closed for the day. I frantically searched for help and came to know that there is one more couter in terminal 1 which is open till late night. But it was a long walk to the terminal 1 which took me another 1 hour. When I found it, I got $500 cash. I made couple of calls to Cincinnati and India. Here I must mention that I finally found some luck here. I did not know how the calling cards work and how to make the calls from the pay phones. This girl walked to me on her own and offered me help. She even gave me her calling card which had some money left in it. Apparantly, she was leaving New York and would not be needing the card again. She dialed the number for me and then left, but not before making a permanant impression on me. I would not forget her. 

I went to buy a cup of coffee. When I my pocket to pay, I found out that I had lost my wallet (It could happen only on that day). I had never lost my wallet in Mumbai. I suspected the big bloke standing just behind me in the line. But I could not confront him. I was not sure. And he was really big. Finally, I requested the lady at the counter to use another travellers check and went to the Police.

So as it happened, The first day in America, and I was looking for Police!!!. I found one and I told everything including about my suspicion. The police lady set up a watch on the bloke. After some time, she took me to a closed room. While going with her, I was really frightened. But on entering the room, I found that they had found my wallet in the waiting area where I had sat some time before to arrange the money that I had taken in exchage for my checks. I felt ashamed. After verification, I finally got my wallet.

It was now time to search for a hotel where I can spend the night. Almost all hotels were full due to the many cancelled flights that night. But I found one. It was located inside the airport area itself. And hence, it was costly also. But I had no choice. When I reached there, I found a long queue to check in that hotel. It seemed to be my destiny that day to wait in line for everything that I did. So after 1 hour, I was finally resting in a tub full of hot water.

I had to catch a plane at 6:00 AM, So I slept at 12:30. After only 3 hours of sleep, I had to wake up and get ready. I reached JFK only to find one more long que to check in to the airport. When I reached the counter about half hour before the departure time, I was very happy. But the bad luck continued. They told me that the flight does not depart from this airport. I had to take a taxi and go to LaGuardia airport, but by the time I reached there, I had missed the flight.

They didnt have any direct flight to cincinnati that day. So I booked a ticket on a flight that would take me to Columbus and then from their a second flight to Cincinnati.

I reached at Columbus airport at 10 Am. The connecting flight to Cincinnati was at 12. I didnt want to take any chances, so I chose to wait in the waiting area. After about 1 and half hour, they announced that the flight was delayed and will now take off at 1:20 PM. I was frustrated and decided to roam around the airport. After eating some crap food, I came back to boarding gate at 1:10 to catch the flight. But to my surprise, the counter was empty. my heart skipped a beat. When I asked a lady at other counter, she told me that the flight had left at 1 PM. I was shocked and asked her how can they leave at 1 when the announced departure time was 1:20PM? She told me that most of the passengers were present so they left and she handed me another ticket to cincinnati at 3:00. This time I didnt dare to leave the boarding area. After 2 hours, I finally boarded the flight to Cincinnati. By that time, I had got an idea about my luck that day and thought that Cincinnati must be having its share of my bad luck and I was right. When I got down at Cincinnati, and went to collect my luggage, they told me that my luggage has not reached and they didnt know where it was then. I had expected this and was in no mood to argue.I gave my local numkber and asked them to inform me when it arrives and finally left for home. thankfully, I didnt have any difficulty finding the house. When I reahed there, I just dropped my handbag and sat for 30 min thinking about my luck and my journey….

I had reached cincinnati about 48 hours late…..Without any luggage, had come from Columbus to Cincinnati in 6 hours when I could have come by a taxi in about 1 hour. I can not recall any time when I was so much out of luck.

Anyways, that was the end of bad luck for me in U.S. I got my luggage that night at about 11:30 and enjoyed my first weekend immensly, doing lots of shopping and shaking off the jet lag.
That’s how my U.S. trip started. I had a lot of fun there after the first few days of bad luck. But those stories will come later. For now, I am glad that I have finally finished writing this one.


vimrc

June 11, 2008

This is my .vimrc file:

hi Comment ctermfg=5
set nu
set ts=2
set ai
set foldmethod=marker
set foldcolumn=1
set foldtext=MyFoldText()
function MyFoldText()
let line=getline(v:foldstart)
let sub = substitute(line, ‘##{{{’,”,’g')
return v:folddashes . sub
endfunction
highlight Folded ctermbg=0
highlight Folded ctermfg=7
highlight foldColumn ctermbg=0
highlight foldColumn ctermfg=7


Sendmail in a shell script

May 28, 2008

Someone asked me to write a script that will send mails to a particular email id. I had not used any such script before. So I had to search quite a lot. Here is the simple shell script that will send mail to the specified email ids. Currently it does not support attachments.

#!/usr/bin/ksh
#———————————————————————-
# Name: SendMail
# Purpose: To send mails using the sendmail command
# Usage: SendMail
# Owner: Ketan Joshi
# Setting: Just change the variables at the start of the script to
#          appropriate values. Create a message by modifying the string BODY
#          You can even have html tags in the body.
# Limitation: Currently, this does not support attachments.
#——————————————————————–
#Temporary file for containing the mail message
tmp=/tmp/mail-body-`date +%F`;
touch $tmp && chmod 600 $tmp;
#Set up the various headers for sendmail to use
TO=’ketan.joshi@oracle.com,saurabh.abhishek@oracle.com’;
CC=”;
FROM=’ketan.joshi@yahoo.com’;
SUBJECT=’Test Mail’;
MIMEVersion=’1.0′;
CONTENTType=”text/html; charset=us-ascii”;
#Here write the content of your mail.
BODY=”
<b>Hello from ketan.</b>
This is test mail.
“;

echo Sending the mail.
echo -e “To: $TO” > $tmp;
echo -e “Cc: $CC” >> $tmp;
echo -e “From: $FROM” >> $tmp;
echo -e “Content-Type: $CONTENTType”>>$tmp;
echo -e “MIME-Version: $MIMEVersion”>>$tmp;
echo -e “Subject: $SUBJECT”>>$tmp;
echo -e “Body: $BODY”>>$tmp;

/usr/sbin/sendmail -t < $tmp;

rm -rf $tmp;


VI commands

May 24, 2008

VI COMMANDS

I got this list somewhere on the net. I have not reviewed it completely, but at the first glance, this looks correct. Enjoy…

CURSOR & LINE POSITIONING
h  Move left one character.
i  Insert text move into insert mode before the current character.
j  Move down one line.
k  Move up one line.
l  Move right one character.
0  Move to beginning of line.
$  Move to end of line.
Backspace Move left one character.
Enter Move to beginning of next line.
(  Move backward one sentence.
)  Move forward one sentence.
+  Move down to beginning of next line.
-  Move upto the beginning of previous line.
G  Move to last line in file.
nG Move to line no. n in file.

WORD POSITIONING
B  Back up one space-delimited word.
b  Back up one word.
W  Move forward one space-delimited word.
w  Move forward one word.
e  Move to the end of the current word.

WINDOW POSITIONING
H  Move to first line on screen i.e. “Home”.
M  Move to middle line on screen.
L  Move to last line on screen.
^f Move forward one screen of text.
^b Back up one screen of text.
^d Move down half a page.
^u Move up half a page.

TEXT EDITING
a  Append text move into insert mode after the current character.
A  Append text at end of current line.
i  Inserts text at cursor.
I  Inserts text at beginning of current line.
Esc Leave insert mode, return to command mode.
R  Overwrite text from cursor position.
r  Replace the current character with the next pressed.
O  Open new line for insert above the current line.
o  Open new line for insert below the current line.
U  Undo replace current line if changed.
u  Undo the last change made to the file.
:e file   Edit a specified file without leaving vi.
C  Change text through the end of line.
c  Change text in the specified range cw changes the following word,
whereas c} changes the next paragraph.
{  Move backward one paragraph.
}  Move forward one paragraph.

DELETION
x  Delete a single character at current position.
X  Delete to left of cursor.
dw Delete a word from cursor to the next space/punctuation.
dd Delete a line.
nx,ndw,ndd   Delete n chars,n words,n lines.
d0  Delete line from cursor to beginning of line.
d$  Delete line from cursor to end of line.

MISCELLANEOUS
^g Show current line number and other information about the file.
^v Prevent vi from interpreting the next character.
^l Clears and redraws the current window.
:! Invoke specified UNIX command.
J  Joins the line below current line with current line.
~  Changes current char to Upper case from lower case and vice versa.
:sh Return to Shell. Type exit to get back to vi.
.  Repeats action performed by last command
!!  Replace current line with output of UNIX command.
!}  Replace current paragraph with the results of piping it through
the specified UNIX program or programs.

QUITTING
ZZ  Write buffer to file and quit.
:w  Write the edit buffer to the system.
:q  Quit vi if changes have been written.
:q! Quit vi throwing away any changes made.
:w file  Writes buffer to specified file.
: w! file  Overwrites specified file with contents of buffer.

SEARCHING
/pattern  Search forward for the next line using a specified pattern.
?pattern  Search backward for the next line using a specified pattern.
n  Repeats the last search command.
N  Repeats search command in opposite direction.

BLOCK COMMANDS
:r file  Read the contents of a specified file, including it in
the current edit buffer.
:m,n d  Deletes lines from m to n.
:m,n mo p Moves lines m to n after line p.
:m,n co p Copies lines m to n after line p.
:m,n w file  Writes lines m to n to specified file.
:m,n w>>file Appends lines m to n to specified file.
:r !command  Execute shell command and output of command is read
at current position.

FIND AND REPLACE
:s/str1/str2  Replaces first occurence of str1 with str2 in current line.
:s/str1/str2/g  Replaces all occurences of str1 with str2 in current line.
:m,n s/str1/str2/g range of command from m to n.
:1,$ s/str1/str2/g range of command from first to last line.
:.,$ s/str1/str2/g range of command from current line to last line.
:1,. s/str1/str2/g range of command from first line to last line.

DELETE AND PASTE
“nP  To Paste nth latest deletion after current line.n range is 1-9.
“xdd,xndd,xdw,xndw Deletes 1 or n lines, words and stores in buffer named x.
    (x can be any alphabet)
“xp  Pastes from buffer named x at current cursor position.

COPY(Yank) AND PASTE
yw  Yanks word from cursor position.
yy  Yanks line from cursor position.
y$  Yanks line from cursor position to end of line.
Y0  Yanks line from cursor position to beginning of line.
nP  Pastes nth latest yanked buffer. n range is 1-9.
“xyy,”xnyy  Yanks 1/n lines to buffer named x.
“xyw,”xnyw  Yanks 1/n words to buffer named x.
“xp  Pastes buffer x at current position.

ABBREVIATION
:abbr a bcd   Define abbreviation a for phrase bcd.
:abbr   Show current abbreviations, if any.
:una a Unabbreviates the abbreviation a.
:map a bcd    Map key a to the vi commands bcd.
:map   Show current key mappings, if any.

MULTIPLE FILES
vi fn1,fn2,fn3  Loads fn1,fn2,fn3 into vi for editing.
:n  Move to the next file in the file list.
:n! Move to next file in list without saving current file.
:rew  Move to first file in list.
:rew! Move to first file in list without saving current file.
:args Displays file list in buffer.
:f  Displays name of current file.

SET COMMANDS
:set nonu  Turn off line numbering.(Default)
:set nu    Turn on line numbering.
:set eb    Turn Speaker on.(Default)
:set noeb  Turn speaker Off.
:set ai    Turn auto indent on.
:set noai  Turn auto indent off.(Default)
:set ic    Ignore case in Pattern search.
:set noic  Do not Ignore case in Pattern search.(Default)
:set mesg  Permit reciept of message from other terminals.
:set nomesg  Do not recieve messages. (Default)
:set showmode  Display current working mode.
:set noshowmode  Do not display current working mode.(Default)
:set aw  Auto write buffer to disk before switching to next file.
:set noaw  Do not write buffer to disk before switching to next file.(Default)


Taking backup of your files

May 22, 2008

Here is a small script that will automatically create a backup directory and take a backup of your files.

The script needs many improvements but, in its simplest form, I found it useful. I’ll improve it as and when I get some time.

#! /usr/bin/ksh
echo “Backing up $1″;
vDate=`date +%Y%m%d_%H%M%S%p`;
newFile=”$1_$vDate”;
if [[ $1 = "" ]]
then
echo “Usage: backup <filename>”
exit;
fi
if ! [ -d 'bkp' ]
then
echo “bkp directory is not present. Creating the same.”
mkdir bkp;
fi
echo “copying $1 to bkp/${newFile}”;
cp $1 ./bkp/${newFile};
chmod -wx ./bkp/${newFile};

How to use this?

I have saved this script as “backup” and given it execute permission.

To take a backup of a file, run the following command at command prompt:

$ backup <filename>

This will first check if a directory “bkp” is present in the current directory. If not, it will create it and copy the file to it with name changed to reflect the date and time of copying.

Currently, it handles only one file at a time, I need to modify this to handle multiple files. But I guess I will do that in Perl instead of shell as it looks simpler.