Saturday, January 4, 2025

Cycling Expedition from Pune to Statue of Unity

I was fortunate to be a part of the four day cycling expedition from Pune to Statue of Unity, covering a distance of 100+ kilometers each day.

The Preparation

Two weeks prior to the expedition, Tapan and I did a 100+ kilometers ride from Pune to Velhe and back, via Pabe ghat.  This proved highly beneficial during the four day tour.  Pabe ghat is a monster.  It either makes you or breaks you.

Tapan and I had never done a multi-day cycling tour.  So the challenge for us was like doing a Pune to Velhe ride via Pabe ghat on four consecutive days.  We tapered down during the last two weeks, doing mostly short rides and the usual weekend football game.  

Likewise, each member of the expedition did their own preparation.

Considering the roads and the terrain, a lightweight hybrid cycle is best suited for this expedition.  I chose to ride my Marin San Quentin 1 downhill mountain bike.  I was the only one riding a mountain bike.  Two were riding road bikes and remaining seven were on hybrid cycles.

For years, I like riding off the roads.  I am not used to riding long flat roads for hours after hours with the same momentum.  The downhill mountain bike I have is obviously not made for riding long flat roads.  So I imagined I'd drop back from the hybrid cycles and the road bikes during the tour.  


Organised by : Sprocket Services LLP, Pune, Maharashtra, India

Riders : 10

Supporting Crew : 4

Ride distance : 555 kilometers

Days : 4


The Plan

Day 1 - Saturday 28 December 2024

Warje, Pune to Sangamner, Maharashtra

Ride distance : 155 kilometers


Day 2 - Sunday 29 December 2024

Sangamner, Maharashtra to Saputara, Gujarat

Ride distance : 150 kilometers


Day 3 - Monday 30 December 2024

Saputara, Gujarat to Mandvi, Gujarat

Ride distance : 130 kilometers


Day 4 - Tuesday 31 December 2024

Mandvi, Gujarat to Statue of Unity, Kevadia, Gujarat

Ride distance : 120 kilometers


What Happened


Each day we started to ride early morning.  Halt for breakfast was at about 40 kilometers.  Halt for lunch was at about 100 kilometers.  In between were hydration breaks, well managed by the support crew.  We typically did a short break after every 25 kilometers.  

Sarang was ahead of all the rides on his motorbike.  Somewhere in between the riders, Chintan was driving the car.  The support vehicle was always behind the last rider.  We kept this formation throughout the tour.  At the road intersections, Sarang used to do marking on the road.  To avoid detouring of the riders.

Breakfast

The early morning ride till breakfast was the easiest of the day.  Temperature was low and we were fresh from the night's rest.  After the breakfast, our ride started with the same energy.  Then temperature began to rise.  12 noon to 1 PM was the difficult time of the day to ride.  The last few kilometers before reaching for lunch break were tough.

I usually avoid eating lunch during full day cycle rides.  Likewise, on the first day I had a mini lunch.  But on the subsequent days I had to eat full lunch.  The energy drain was so heavy that not having lunch was not a choice.

Gujarati Thali

Having a 30 minutes nap after the lunch is necessary.  Energy level gets restored by the lunch and the rest.  But only for a limited duration.  In the ride after the lunch, the fatigue grows again.

Kathiyawadi Thali

Breakdown cycles and riders were swept by the support crew.  They are the reason why we could do this expedition.

As I had imagined, the hybrid cycles and the road bikes were faster than my mountain bike.  The roads were mostly not suitable for the mountain bike.  I was at the tail end of the pack on the first day.  Riding the 15 kg mountain bike having broad tires, I was burning more energy than those riding the lighter hybrid cycles and the road bikes.  

So the second day I chose to ride the spare hybrid cycle.  That saved some energy for me.

On the third day I was back on my mountain bike.  The road from Saputara to Mandvi has many downhill sections.  The downhill mountain bike never leaves the grip on the road.  Whether a truck is passing by, or heavy headwind or sidewind, or sharp declining turns on the road, or too much bumpiness of the road - the downhill mountain bike never lets you down.

On the fourth day, I wanted to ride the spare hybrid cycle.  But it had to be used by the rider whose cycle had went out of order.  So I was riding my mountain bike on the fourth day.  The afternoon heat and the energy drain and the uphill sections were a way too much for me while reaching for the lunch break.  So after the lunch I took the Scott lightweight hybrid cycle that Nitin Sir was not riding.  And I was riding with the same pace as others.  In the last section of the tour, I was back on my mountain bike.  When the signboards mentioning the distance to the Statue of Unity started to appear, we were delighted with the thought that the destination is now within reach.

Private vehicles running on petrol and diesel are not permitted in the areas surrounding the Statue of Unity.  Cycles are allowed.  So we could ride all the way to the public bus station.  With the cycles parked safely, we visited the Statue of Unity, the tallest statue on earth as of today.  Sarang had already purchased the tickets that are required for going to the viewing gallery inside the statue.  Another example of his perfect planning of the whole trip.  We were the only ten folks in the crowd wearing cycling clothes, helmets, hand gloves.  When you arrive riding 555 kilometers all the way from Pune, being in the cycling getup is so apt.

DOs and DON'Ts

Be in the correct riding posture.  Use the correct combination of gears.

Don't ride at your top speed.  Conserve energy by riding a bit slower. 

Do not over-eat.  Remember this while having breakfast, lunch, dinner.  Stop eating before you feel 100% full.

Keep drinking water or liquids at regular intervals.  Not having enough water may lead to cramps.

Preferably, have the same liquid throughout the day.  If you have tea, energy drink, sugarcane juice, coffee, soft drink, buttermilk in the same day, that may upset your digestion.  So choose one and stick to it as much as possible.

At the first hint of a cramp, take evasive action.  Don't continue in the same way.  Lower your speed.  Or take a break.  Or apply some topical pain relief spray.  Use your own judgement and decide the best possible ways to avoid a breakdown.  During the ride after lunch on the third day, I sensed a cramp in the right calf.  I slowed down, started pushing with left leg, and rested the right leg.  And applied topical pain relief spray when the support vehicle approached.

Do take a short break if you think you would be hitting the wall.  Hitting the wall is when you get completely drained out of energy, and can't ride anymore.

Be prepared to ride in the hot afternoons under the burning sun.  Some folks are early morning riders who never ride in the afternoon heat.  In a multi-day expedition where you ride all day, afternoon is the treacherous time of the day.

Don't throw garbage on the roads.  Tons and tons of garbage is accumulating roadside.  Humans are killing this planet.  Don't be a part of the problem.  Be a part of a solution.  Carry all your garbage with you and dispose properly.

Help your fellow riders.  This is not a race.  Together we win.  Or together we lose.

Glimpses of the Expedition

संकल्प बोल के


हम तो निकल पड़े


हर द्वार खोल के


गगन कहे








Honorable Mention

T. Shivmani

During one of the hydration breaks, we met this guy.  His hometown is Rameshwaram, Tamilnadu.  He is travelling all over India on a moped bike.  He has visited Bangladesh as well.  He is selling the artifacts from the shop on his moped bike. A mobile shop.  You get to purchase something from this shop only if the shop comes in your vicinity. Luck by chance.

A Land Snail

We saw this land snail during a hydration break.  It would be living in a vicinity of may be a 100 meters.  And what if that area is littered with garbage thrown by humans.  Would you like to live in a home littered with garbage?  Then why should the creatures of this planet live in inhospitable conditions?  Why throw garbage roadside and move on?


VIPs of the Expedition

Name : Malhar
Age : 11 years
Road Bike Specialist


Name : Vivan
Age : 16 years
Future Champion


Support Vehicle Driver
Patiently drives behind the last rider of the expedition


The Technician
When a vessel breaks down 200 miles away from the shore, he is the Magician


The Leader of the Pack

Sarang organised and executed the expedition in the best possible manner.  Giving us the best possible start of the Gregorian year 2025.  The major factor in the success of the expedition is the food and the night stays.  At what time to start the ride in the morning, after what distance and and at which place to halt for breakfast, for lunch, for tea, for the night halt. The hydration breaks. All of this was meticulously planned by Sarang.  Keeping a spare cycle and all possible equipment and spares is another factor in the success of this expedition.  All of this contributed to why we kept riding till the fourth day to the best of our abilities.  The pain in the legs go away in a day or two. The memories stay for a long time.

Sunday, December 8, 2024

What is the difference between ESXi inbox driver and ESXi async driver

 VMware ESXi is a hypervisor software that allows users to create virtual machines (VMs) on physical hardware.

An ESXi driver is a software component that enables the use of a specific device or resource for VMware ESXi.

The ESXi inbox drivers are shipped with ESXi.

ESXi async drivers are developed by hardware vendors or third-party vendors.  They are not bundled with the ESXi software.  They are usually downloaded from Broadcom website and then installed.

When an async driver is installed, the inbox driver is not removed.  This results in more than one driver being installed for the same device.

When both inbox and async drivers are present, both are displayed as installed.  However, only one of them is loaded and is in use.

How to determine which drivers are installed

# esxcli software vib list | less

# esxcli software vib list | egrep <driver_name>

Note : If both inbox and async driver are installed, the above grep command displays both


How to determine which drivers are in use

# esxcfg-info | less

In case of network drivers :

# ethtool -i vmnicX

To identify the vmnic # of the associated NIC :

# esxcfg-nics -l

# esxcli network nic get -n vmnicX


Should you use ESXi inbox driver or the ESXi async driver

Obviously, there is no simple answer to this question.  A careful review of the situation should help to come to a decision.

Factors to be considered could be :

  • Is the hardware vendor doing active development and fixing many issues in the async driver?
  • Do you want to use a native driver or a vmklinux driver?  And why?
  • Comparing the release notes of the inbox driver and async driver, do you see a pattern?
  • Which one seems to be more stable?
  • Which one seems to be more actively maintained?

Although this review may take a long time, making this informed decision may avoid an outage or an unpleasant situation in the future.


Thursday, June 6, 2024

Python hands-on self learning

Classroom training may not be sufficient to learn Python. You have to get your hands dirty. Here are some assignments that you could do, to learn Python the self-help way.

Exercise 1. In a Python script, accept command line arguments. Display all the arguments and also the number of arguments.


Expected output:

$ ex_01.py here there
arguments:
here
there
Number of arguments: 2
$

Exercise 2. Accept a filename as command line argument. Display the contents of that file.

Expected output:

$ cat > ringfile.txt
Three Rings for the Elven-kings under the sky,
Seven for the Dwarf-lords in their halls of stone,
Nine for Mortal Men doomed to die,
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them
In the Land of Mordor where the Shadows lie.
(Ctrl+D)$
$
$ ex_02.py ringfile.txt
Three Rings for the Elven-kings under the sky,
Seven for the Dwarf-lords in their halls of stone,
Nine for Mortal Men doomed to die,
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them
In the Land of Mordor where the Shadows lie.

$

This is similar to displaying the contents of a file using cat command.


Exercise 3. Accept a filename as command line argument. Display the contents of that file in the opposite order that they appear in the file.

Expected output:

$ ex_03.py ringfile.txt
In the Land of Mordor where the Shadows lie.
One Ring to bring them all and in the darkness bind them
One Ring to rule them all, One Ring to find them,
In the Land of Mordor where the Shadows lie.
One for the Dark Lord on his dark throne
Nine for Mortal Men doomed to die,
Seven for the Dwarf-lords in their halls of stone,
Three Rings for the Elven-kings under the sky,

$


Exercise 4. Accept a string as first argument and a filename as second argument. Display all lines of that file which contain the given string.

Expected output:

$ ex_04.py them ringfile.txt
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them

$


Exercise 5. Accept a username as command line argument. Display if that user is currently logged in or not. Run who or w command and use its output to determine if the given user is logged in or not.

Expected output:

$ ex_05.py yogesh
yogesh is not logged in
$
$ ex_05.py root
root is logged in
$
$ ex_05.py roo
roo is not logged in

$


Exercise 6. Accept command line arguments. Consider all command line arguments as user names and for all the given user names, display if they are logged in or not.

Expected output:

$ ex_06.py yogesh pts roo root
yogesh is not logged in
pts is not logged in
roo is not logged in
root is logged in

$


Exercise 7. Display today's date in the format: 22-Aug-2008

Exercise 8. Display yesterday's date in the format: Thu Aug 21 16:58:10 2008

Exercise 8.1. Display tomorrow's date in the format: 21-Aug-2008


Exercise 9. Declare a list as follows:

nums = [5, 10, 15, 23, 20, 24, 30, 33, 40, 13]

Sort this list numerically in ascending order.

Exercise 9.1. Sort this list numerically in descending order.


Exercise 10. Declare a list as follows:

nums = [5, 10, 20, 23, 15, 23, 20, 5, 24, 30, 33, 40, 3, 13]

Find the duplicate elements from this list


Exercise 11. Declare a list as follows:

nums = [5, 10, 20, 23, 15, 23, 20, 5, 24, 30, 33, 40, 3, 13]

Find unique elements from this list


Exercise 12. Accept a string as command line argument. Declare a dictionary as follows:

food={'apple':'red', 'banana':'yellow', 'tomato':'red', 'spinach':'green', 'lemon':'yellow',}

Check whether the given string is present as a key in this dictionary.

Expected output:

$ ex_38.py apple
We've got apple
$
$ ex_38.py orange
We've got no orange

$


Exercise 13. Declare a dictionary as follows:

dict={d:12, b:20, g:2, a:6, e:1, h:13, c:8, f:5}

Display keys and values from this dictionary sorted by keys.

Expected output:

$ ex_13.py
key = a value = 6
key = b value = 20
key = c value = 8
key = d value = 12
key = e value = 1
key = f value = 5
key = g value = 2
key = h value = 13

$


Exercise 14. Declare a dictionary as follows:

dict={d:12, b:20, g:2, a:6, e:1, h:13, c:8, f:5}

Display keys and values from this dictionary numerically sorted by values.

Expected output:

$ ex_14.py
key = e value = 1
key = g value = 2
key = f value = 5
key = a value = 6
key = c value = 8
key = d value = 12
key = h value = 13
key = b value = 20

$


Exercise 15. Declare two dictionaries as follows:

food={'apple':'red', 'rice':'white', 'banana':'yellow', 'tomato':'red', 'spinach':'green'}

fruits={'plum':'red', 'banana':'yellow', 'blueberry':'blue', 'mulberry':'black', 'apple':'red', 'pear':'green'}

Find common keys in these dictionaries.

Expected output:

$ ex_15.py
apple
banana

$


Exercise 16. Declare two dictionaries as follows:

food={'apple':'red', 'rice':'white', 'banana':'yellow', 'tomato':'red', 'spinach':'green'}

fruits={'plum':'red', 'banana':'yellow', 'blueberry':'blue', 'mulberry':'black', 'apple':'red', 'pear':'green'}

Find keys that are present in dictionary %food and not present in dictionary %fruits.

Expected output:

$ ex_16.py
rice
tomato
spinach

$


Exercise 17. Write a program to read file /etc/passwd and prepare a dictionary as follows:

(a) keys of the dictionary would be the user names

(b) corresponding value would be the home directory of that user

Also, display contents of this dictionary.


Exercise 18. Write a program to read file /etc/passwd and prepare a dictionary as follows:

(a) keys of the dictionary would be the user names

(b) corresponding value would be another dictionary as follows:

i. key = uid value = user id of that user

ii. key = homedir value = home directory of that user

iii. key = shell value = default shell of that user

Also, display contents of this dictionary.


Exercise 19. Write a program to find and print the longest word in a text file.

Expected output:

$ python find_longest_word.py ringfile.txt
Elven-kings
Dwarf-lords

$


Exercise 20. Write a function that simulates the roll of a dice. That is, it generates a random number between 1 and 6.


Exercise 21. Accept a filename as command line argument. Display the word that occurs most in it. Also display the number of occurrences of that word.

Expected output:

$ python ex_21.py ringfile.txt
highest occurance: the (9)

$


Exercise 22. Accept a directory path as command line argument. In the given directory, find the file having oldest modification time. Display the file name along with how many days ago it was modified.

Expected output:

$ ex_22.py /foo/
/foo/ does not exist
$
$ ex_22.py /etc/passwd
/etc/passwd is not a directory
$
$ ex_22.py /etc/
motd was modified 167 days ago

$


Exercise 23. Write a python program to validate a PAN codes.

Get PAN codes to be validated on the command line. There could be more than one PAN codes provided.

$ ./pan_code_validator.py BETPK1234M

$ ./pan_code_validator.py CRLCT3456G H2YPJ5678L

Q. What is a PAN number?

A. Please see https://en.wikipedia.org/wiki/Permanent_account_number

No bonus points if you could write a solution within five minutes. A comprehensive solution is better than a fast and clumsy one.


Exercise 24. Accept a filename as command line argument. Assuming that the file passed is a .json file, read its contents and display them.

Before reading the file, make sure that:

(a) it exists

(c) it is readable

(c) it is a simple file (not a directory or a device file)

(d) if the file is not a well formatted .json, display an appropriate error and exit.


Exercise 25. Write a python program to connect to a remote host using the SSH protocol, run ls command, and show the output.


Exercise 26. Write a python program to create and delete directories repeatedly, starting from a given directory path. Obviously, the program should create directories before they are be deleted. This program would be useful for checking certain features of filesystem, and also NFS and CIFS shared drives.

Arguments to this program should be as listed below.

1. directory path - starting point for creating / deleting directories

2. (optional) duration - run for how much duration, in seconds. Default : 300 seconds (5 minutes)

3. (optional) dontstop - run continuously till you stop the script by sending a signal using ctrl + c. This option should override duration.

4. (optional) dirprefix - string to be used while naming directories

Sub-directories in each directory should be named as dir1, dir2, dir3 and so on. If an optional argument dirprefix is mentioned, the string supplied along with it should be used while naming sub-directories.

Obviously, this program should not delete a directory that does not exist. Also, a thread / process should not create a directory which is already created / being created by another thread / process.


Exercise 27. Write a python program to convert English text to Morse code and vice versa. Or better yet, write two separate python programs, one to convert English text to its equivalent Morse code, and another to convert Morse code to its equivalent English text.

Get names of two files on command line, one for input and one for output, as shown below.

$ ./english_to_morse.py --infile notes.txt --outfile notes_in_morse_code.txt

$ ./morse_to_english.py --infile notes_in_morse_code.txt --outfile notes.txt

Read the English text / Morse code from the input file and write the converted Morse code / English text to the output file.

Q. What is Morse code?

A. See http://en.wikipedia.org/wiki/Morse_Code

Q. Which ASCII characters are considered valid for converting to Morse code?

A. Let's refer to http://en.wikipedia.org/wiki/Morse_Code#Letters.2C_numbers.2C_punctuation

Q. Do you know a web site that does this conversion?

A. There are many. Here's one - http://www.onlineconversion.com/morse_code.htm

Q. What would be the criteria to evaluate my solution?

A. No bonus points if you could write a solution within 10 minutes. A comprehensive solution is better than a fast and clumsy one.

You'll surely get bonus points if you could use some python package rather than writing all of the code yourself from scratch.