Tuesday, 20 May 2014

Saving energy and my F5 key

Results day is a nightmare for your F5 key if you are from NIT Calicut. Our servers are pretty bad at handling huge number of requests. Very often the server continuously resets incoming connections. It can be very annoying to manually refresh and check for updates every single time. Our results aren't put up at any specific timing. They can be updated on the page at any time of the day (sometimes even the next day!). This can be very annoying especially if it is your last semester and you have a subject on-the-line. Instead of criticizing our servers like I always used to, this time I decided to find a solution to save me the energy and my F5 key.

Nothing ground breaking - just a simple bash script that makes multiple (tons of) requests to our server and checks if the updates I am looking for have been put up. wget -t inf to take care of the annoying connection resets. Should be an easy read even for the newbies at the terminal.

DISCLAIMER: I am not going to claim it is a great script, but well, it did it's intended job. I wanted to know the link at which the results where put up as soon as it was put up. (It was a matter of another semester at NITC. You can't blame my curiosity.)  And from what I observed from our online group's activity, I just might have been the first one to see the results!

Here's what I wrote:

After a few crashes and fixes, it ran for about 3000+ iterations before I could see "Some update!". Phew.

And yes, I passed all. Woohoo.