Should caste based reservation be allowed?

TL;DR: Caste based reservations should be allowed until caste based discrimination is stopped.

This is an issue which is close to all the Indians and have affected their lives. Despite what the government portrays the ground realities of jobs and education are grim.

On an average there are 20 times more applicants than the number of open positions. Consider NEET which is the eligibility exam for doctors in India, there were 11.5 lakhs (1.1 m) applicants to roughly 56,000 open positions. Out of 56,000 half of the seats are from private colleges which are significantly expensive than the public colleges. The situation is similar or even worse for engineering, chartered accounts or public sector jobs.

To the upper castes, it creates a lot of pressure throughout life whether one is studying or working so they are opposed to it. Some people want government to provide incentives to economically backward people from all castes. This looks like a noble idea, however since everything in India is prone to corruption I highly doubt that people who need the money will actually receive it.

To the lower castes (SC/ST/OBC) this is opens up a window to climb up the ladder both socially and economically. So more and more backward castes want them to be considered themselves included in OBC some OBC castes even want them to be considered SC.

From what I have seen growing up, most people who have received benefits of this reservations are the children of people who have themselves benefitted from reservations once. This opens another problem of whether it is justified to keep giving reservations to people who are already well off?

I was strongly opposed to reservations while I was growing up because it had significantly reduced the number of open seats for me in the colleges I wanted to get admitted to, so I had to settle for a medium tier college. I was also of the opinion that caste based discrimination was a thing of past which is just not true.

Caste based discrimination is very much prevalent in India from North to South. Some people get beaten up because they use wells meant for upper caste. They are not allowed to enter in the temples. People have separate utensils in their homes meant for lower castes. Grooms are not allowed to ride horses in marriage processions. Inter caste marriages are not accepted and sometimes brides and grooms are even killed.

In my opinion, until we are really equal in the society where people are not harassed and inter-caste marriages are a norm, caste based reservations must be allowed.

Spark streaming reduceByKeyAndWindow unstable application

I wanted to run a job which runs 24×7 and which reports if certain keywords occur more than a N times in the stream. Spark streaming looked a ideal candidate for this task. Spark has a reduceByKeyAndWindow function which was exactly what I was looking for.

I decided to use a window length of 1 minute and slide interval of 30 minutes. I had assumed that it will discard all the keys every 30 minutes. While running the job I noticed that the memory usage and the processing time kept on increasing to a point that the application would never be stable i.e. each job was taking more time than the window interval. So new jobs kept on getting added to the processing queue.

Since the documentation on this function is so little that I had to ask around the mailing list for the . After a few days a guy responded that I needed to add a filter function which will discard the unwanted keys.

reduceByKeyAndWindow(reduceRows, invReduceRows, 1800, 60, filterFunc=filterOldKeys)

So now the actual function call looks something like this. The filterOldKey is a simple function where I check if count of the key is greater than 0. This solved my problem.

Spark streaming: Fixing all executors not getting jobs

I was working on a feature recently which needed a streaming job that runs 24×7 and processing 100 million rows per day. The spark web ui is a wonderful tool to look at how things are running internally. While debugging I noticed that the streaming jobs were getting allocated to only one machine. Spark has a set priority to dispatch jobs to the executors based on proximity (on the same host, in the same pool etc) and if they complete the job within a fixed interval then all the jobs are sent to the same executor.


spark.scheduler.mode FAIR
spark.locality.wait 100ms

By making the above changes to spark-defaults.conf you can force spark to dispatch the jobs to other nodes. You might have to tweak spark.locality.wait a little so that it suits your needs.

Sending mails from munin using custom command

We use Sendgrid for email delivery on our cloud. Using custom commands in munin can be tricky. After struggling for some time I wrote a small python script to send emails from munin using sendgrid.

Add this line to munin.conf

contacts mycontact
contact.mycontact.command /usr/bin/sendemail "[Munin] Alert for ${var:host}" "warnings: ${var:wfields} / criticals: ${var:cfields}"
contact.mycontact.text text

Save this file as sendemail in /usr/bin and give it execute permission using chmod +x /usr/bin/sendemail. You should configure the email and sendgrid login details before using this script.

import smtplib, sys
from email.mime.text import MIMEText
from email.Header import Header


if len(sys.argv) < 3:
    print 'Usage: ./sendemail "" "This is the subject" "This is the email text"'

smtp = smtplib.SMTP('', 2525, '')

emailIds = sys.argv[1].split(',')
subject = sys.argv[2]
body = sys.argv[3]

message = MIMEText(body)
message['Subject'] = Header(subject)
message['From']    = DEFAULT_SENDER
message['To']      = ','.join(emailIds)

smtp.sendmail(DEFAULT_SENDER, emailIds, message.as_string())

You should start receiving alerts from munin.

Motorcycle review: Bajaj Avenger 2013

I bought Avenger in July 2013. Specification can be read at I have toured extensively in Karnataka and Leh, so I think this review will definitely help you make up your mind.


  • Engine: The 220 cc engine gets you off from 0-60 pretty quickly. This is a cruiser so couple of seconds does not matter. It will accelerate till 80 fairly. Once you cross 90 there is not much power left in the bike, you will accelerate very slowly. It will get you till 110. You will feel the vibrations on the foot pegs after 90. The sweet spot is between 70-90. You can just relax and cruise on an open road at that speed and you will absolutely love the ride.
  • Maneuverability: Since it is long (longer than RE Bullet also) and quite heavy so it is quite frustrating to ride in traffic. It feels really heavy when riding at speeds below 30. It needs more area to make u-turns. But once you touch 40 it feels lighter, you can even lean at corners.
  • Mileage: In city I get around 28-32 km/l and on highway around 35-38 km/l. I rev the engines hard so I can’t complain on the mileage. People have managed to get 45 on highways.


  • Big seat : This was a big factor while choosing this bike. Since I wanted to ride long distance I wanted comfortable seats. The stock seats were better than other bikes but I added a gel pad and 0.5′ foam on top of the seat for more comfort.
  • Seating position: The low seating position with legs stretched out gives you a chair like seat, which is quite comfortable. The “Feel like god” tagline makes perfect sense when you hop on it. It may take you a while to get used to it though. I am 6 feet tall and weigh 82 kg and I find it extremely comfortable. Be prepared for some splashes in the rainy season though 😉
  • Good Headlights: The default head lights are good. The whole road will be lit perfectly in high beam.
  • Chrome: Bajaj has used sufficient chrome on it to make it shine. I absolutely love it.
  • Electric Ignition: It comes only with an electric ignition. I have not faced any problem with starting even while I was in Leh. Just one push of the button and the engine will come to life.
  • Back Rest: There is a back reset for pillion rider. I use to to strap my luggage 🙂
  • Types: The MRF Zappier tyres are good. I have done 15,000 km and they still look good. I have had only one puncture.


  • Braking: The front tyre is stretched out, so it can be a nightmare at turns and skids at times. You will learn how to use both the brakes to control it.
  • Odo/Speedometer/Indicator: It comes with analog meters. The speedometer starts swinging once you cross 100 km/hr. I have managed to clock 115 km/hr on it but I am not sure how faulty the meter was. The turn, high beam and neutral indicators are slapped on the tank so you have to look down to see it which is really annoying. There is no RPM indicator.
  • Fuel Gauge: The fuel gauge is faulty. You just can’t depend on it. I have also noticed water droplets inside the fuel gauge. This has been seen on other avenger bikes, wonder why they have not fixed it.
  • Tank Capacity: It can hold 14 litres of petrol. I wish the tank was bigger.
  • Rear View Mirror: The stock mirrors are really bad. I have to change mine.
  • Pillion Seat: The pillion seat is very small, good for only city rides.
  • Rider Foot Pegs: I wish the foot pegs were a little more forward. It would have made the seating position more relaxed.
  • Suspensions: The rear suspensions are hard and you will feel every bump on your butts.
  • Gear: The gear shifting in not smooth. It gets stuck during down shifting.

It is really a good motorcycle for the price you pay. I wish Bajaj did something to improve its design and performance.

Winter Ride

2014 was an incredible year for me. I travelled a lot. I decided to end this year with another ride with some fellow bikers. This was a 4-day ride in which I covered Mudigere, Kudremukh, Sringeri, Agumbe, Chikmanglur and Mullayangiri.

We rode on the first day to Mudigere. A home stay was arranged for stay. It was a very secluded place and it took us a while to locate the place.

Breakfast break

We went to a sun set point to spend the evening.

Next day I left for Sringeri for another solo ride. The roads were not very good. However Kudremukh forests were particularly very scenic to ride on.

Almost dried Bhadra river

Inside Kudremukh saw a sign board for a dam, so decided to check it out 🙂 It looked more like a desert than dam at this point since the river had dried.


A little more chrome?

Kadambi waterfall

Reached Agumbe sunset point around 3:45 pm. It was extremely crowded so I decided to head back to Sringeri and find a stay.

Sun set

Sringeri – Chikmanglur

Condition of road was pretty bad at the start. I had started around 6:30 am. It was extremely foggy. At one point I felt like I should head back to the hotel. Once the sun was out fog went away and the roads improved.

Water droplets on cobwebs.


Headed back to Bangalore next day. Reached 1000 km on odo somewhere on NICE road.


Setting up VPN using OpenVPN on Google Cloud or AWS

VPN is a good way to protect your cloud infrastructure from attacks. In the method below I will list down the step how to log in to your vpn machine and access the cloud LAN from you laptop.

I am using Debian on Google Cloud as an example. The setup process should be similar on other clouds. The cloud lan is in the network and the vpn lan will be in the network

1. Setup firewall rules to allow connection to vpn machine:
Networks > your network (usually named default) > Firewall rules:

Create new:
Name: VPN Traffic
Source IP Ranges:
Allowed Protocols/Ports: tcp:1194
Target Tags: vpn

2. Spawn a new debain machine, go to advanced and tag it vpn. Also enable IP Forwarding.

Log in and run this:
“sudo sysctl -w net.ipv4.ip_forward=1“
Make the same change in “/etc/sysctl.conf“

3. Install openvpn:

sudo apt-get update
sudo apt-get install openvpn

4. Set up openvpn

* Create a new directory with the command sudo mkdir /etc/openvpn/easy-rsa/.
* Copy the necessary files with the command sudo cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0/* /etc/openvpn/easy-rsa/.
* Change the ownership of the newly copied directory with the command sudo chown -R $USER /etc/openvpn/easy-rsa/.
* Edit the file /etc/openvpn/easy-rsa/vars and change the variables listed below.

The variables to edit are:

export KEY_CITY="SanFrancisco"
export KEY_ORG="Uberlabs"
export KEY_EMAIL=""
export KEY_CN="FooBar"

Once the file has been edited and saved, we’ll run several commands must be entered in order to create the certificates:

cd /etc/openvpn/easy-rsa/
source vars
./pkitool --initca
./pkitool --server server
cd keys
sudo openvpn --genkey --secret ta.key
sudo cp server.crt server.key ca.crt dh1024.pem ta.key /etc/openvpn/

Client Certificates

The clients will need to have certificates in order to authenticate to the server. To create these certificates, do the following:

change KEY_CN in vars file everytime you create a new client cert, else you will notice that hostname.crt is of 0 bytes. Or you can use KEY_CN=someuniqueclientcn ./pkitool client1.

cd /etc/openvpn/easy-rsa/
source vars
./pkitool hostname

Files needed to setup client
* /etc/openvpn/ca.crt
* /etc/openvpn/easy-rsa/keys/hostname.crt (Where hostname is the hostname of the client).
* /etc/openvpn/easy-rsa/keys/hostname.key (Where hostname is the hostname of the client).

sudo cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/
sudo gzip -d /etc/openvpn/server.conf.gz

Open /etc/openvpn/server.conf and make the below change. SSH does not work properly in udp mode.

proto tcp
push "route" #this is a change

While udp is recommended by openvon but ssh was failing when I tried to ssh on some other hosts on the cloud.

Configure iptables to allow traffic from VPN to LAN
iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE

TIP: Restart openvpn every time you make a change in iptables they are not reflected instantly.

sudo service openvpn restart

Client setup:
Install openvpn on your laptop. Copy Sample client.conf to /etc/openvpn. Save the client files in /etc/openvpn/

proto tcp
remote 1194
ca ca.crt
cert roshan-home.crt
key roshan-home.key

sudo service openvpn restart

sudo ifconfig in 30 seconds you will see a new vpn interface tun0. You should be able to ping 10.240.x.x and ssh.

Additional Debugging:
* Use routing table info to see if it is set correctly route -n or netstat -rn
* tcpdump to see if icmp packets are received tcpdump -i any icmp
* netcat or telnet to see if vpn port is open

netcat -z -v 1194
telnet 1194


Tips for planning your motorcyle trip to Leh


  • Read and research. Start here:…-travel-guide/…ate-guide.html See lot of photos, will keep you excited 🙂
  • You can ride solo, however I would highly recommend against it. Form a group on Bangalore Bikers or BMC Touring. Ride with experienced bikers. Newbies will find it daunting to ride everyday. I had a guy in my group who had slowed down everyone.
  • Consider taking your own bike if it is in good condition. If you own a bike that an engine more than 200cc then you may not have to do any adjustment. Otherwise you need to get air fuel mixture adjusted so that you can get more power out of your bike. This can get this done in Manali. Rental bikes may not be reliable and if they break down it will cost you in money and time. Carry spare keys.
  • AMS may or may not affect you. Diamox is good to use as a precaution against AMS. If you are allegic to Sulphur, you should consult a physician. Start taking one tablet everyday from at least 2 days before you reach Manali. It takes 12-24 hours to show effect.
  • Purchase plastic sheets, rubber/gum boots, petrol cans, bungee cords and rain coats. These things can be bought in Manali. Rubber boots cost only Rs 250, it will save your feet from getting wet. Carrying extra bungee cords and plastic sheets is advisable. You can buy rain coats in Bangalore itself.
  • Try to reach Manali on a Saturday. Market is closed on Sunday. Road to Rohtang Pass is closed on Tuesday morning (you should verify this from a local guy, call up some rental).
  • Buy thermal inners both top and bottoms. Dont carry lots of clothes, you will anyways have to wear thermal inners. But carry enough warm clothes. It becomes too cold after sun set.
  • Buy thick balaclava, thick muffler, 3 pairs of woolen socks.
  • If carrying mesh jacket, carry rain liner and additional jacket to wear inside. I had a DSG Nero, which saved me from cold. It is water proof also (if you close all the zips properly). Wear inner inside gloves. Gloves should not have air vents.
  • Try to find out if you can prevent fogging on the helmet visor. I had keep it open for the most part.
  • Learn how to fix a puncture and clean/change spark plug. That is the least you should know.

During the ride:

  • Always start early. The roads are terrible and it becomes extremely cold once it is dark.
  • Once you cross Keylong, switch off the phone. You won’t get signal in case of prepaid sim. Only postpaid Airtel and BSNL work in after than in some areas. You will get access to network once you are close to Leh. Charge your batteries whenever you get the opportunity. A small spike buster will come handy, we had one.
  • I will advise not listening to songs during ride since most of the roads are on moutains, you should be able to hear any sound of incoming vehicle.
  • Stay alert all the time. You can not make errors there and it can be fatal. There are no hospital facilities.
  • Do not stuff yourself during meals. Take frequent breaks, eat light. This will give you some rest during bad sections of road. You will find tents or eateries every 60-70 kms.
  • NO liqour or smoking!
  • Carry at least 6-8k in cash. Keylong has the last ATM on the route. If you get stuck money will be really handy. If you are carrying multiple luggage, split your money in them.
  • Wave to all the riders. Foreigners may not respond but Indians certainly will 🙂

Places between Manali to Leh:
1. Koksar – 75 km from Manali – Home stay
2. Tandi – 108 km from Manali – Last petrol pump, bike repair
3. Keylong – 115 km from Manali – Hotels and Home stay, ATM, bike repair
4. Jispa – 140 km from manali – Hotels and tents
5. Zing-Zing Bar – ~180 km from Manali – only tents – don’t halt here for the night
6. Sarchu – ~ 250km from Manali – Only tents
7. Pang – 170 km to Leh, only tents – dont halt here for the night
8. Rumtse – 80 km to Leh – Homestay available
9. In some villages approx, 15 km from Rumtse, I noticed designated camping spots, could not see any home stay though.

You will find eateries in all these places. If you are a hygine-freak prepare to live on chips and water 😛

Road Condition:
1. Manali to Rohtang – Good
2. Rohtang to Koksar – Bad, if it has not rained otherwise pathetic as it will be extremely muddy. Streams of water flowing on road.
3. Koksar to Keylong – Half of the road is good. Then there are potholes and sometimes gravel. Streams of water flowing on road.
4. Keylong – Baralacha – Good. Streams of water flowing on road.
5. Baralacha to Sarchu – Pathetic
6. Sarchu to Pang – Good till you reach the bottom of Gata loops, then pathetic to Pang.
7. Pang to Leh – Bad for a few kilometres then very good. Then a bad stretch of 15 km till you reach Taglang la. After that very good roads till Leh.

Almost 60% of road is bad. This should help in you planning. They are making a tunnel under Rohtang Pass which is scheduled to open in 2017. Go before that happens, Rohtang top is beautiful 🙂

In my opinion riding to Leh in 3 days makes sense. You can take break at Keylong or Jispa, Sarchu and then Leh. It is not a race, try to enjoy the trip. Also three weeks seems apt for this ride because there is so much to see.

Best Season:
Avoid monsoon season. Ride in May-June or September. It will be less crowded but colder in September. Stays will be cheaper and easier to find. Always negotiate the price. If you are renting bikes also you may be able to get some good deal.

Checklist for motorcyle preparation:…rcycle-ladakh/

This is strictly my opinion:
If you would like to enjoy the view, motorcycles are certainly not the best way to explore this region since roads are not in very good condition. Car will be a good option. There are lot of taxi services to Leh from Manali. You can get taxis from Leh also. There are lot of tour operators also.
But then we all love to ride!

Day 13-14 – Beautiful Jispa – Back to Manali

We decided to take the day off and enjoy this beautiful village. Jispa is a very small village with couple of hotels and tents. Green trees, a river and snow filled mountain tops. We decided to head to the river.


I’ll come back!

The trip is going to be over 🙁

River Chandra and Bhaga meeting at Tandi to form Chandrabhaga. This river later becomes Chenab.


Sun set at Rohtang.