Posts

valley of flowers: part IV

Image
Day 4, Tue Aug 26. After a wonderful, pleasureful and captivating trek in Valley of Flowers , time was now to take on the challenging ascent of Hemkund . The trek goes from an altitude of 3048 m to 4320 m over a distance of 6 km. This trek is dubbed as challenging by even most avid trekkers. I think it's more the lack of oxygen and other high altitude conditions that make this trek challenging. We got up at about 6 am again. Lit up a candle for bathroom as it was little dark (no electricity, remember?), dealt with a centipede in our basin, freshened up, ordered for hot water bucket, had bath and were ready to rock by 7:30 or so. I don't remember what we had for breakfast that day - must be aloo paratha considering the limited options :) Weather wasn't looking very good. The day was overcast. There was mist everywhere and soon it started drizzling too, which was not a good thing as we were not carrying any rain gear with us. Pankaj's jacket was water resistant (not water...

valley of flowers: part III

Image
Against all your expectations, part 3 comes much sooner. So, where were we? Yeah, we were sleeping in the TRH in Ghangharia. Day 3, Mon Aug 25 . We got up early again at about 6-6:30. Had tea, ordered for the hot water bucket, took bath and phew, we were ready to trek again. Now, when it comes to having breakfast in Ghangharia, there are not many options. In fact the only options are aloo paratha, if you are lucky and there is bread in town then butter toast, and if you don't mind eating eggs which could be 2-3 months old then bread omelet. On that day we had butter toast. Bread slices were the smallest I had ever seen and to make us feel even worse about it, each butter toast cost 35 bucks. Anyway, we started our trek at around 8:40 am or so. After climbing on a decently steep trek for about 10-15 min we reached the point where the route for valley of flowers separates from that going to Hemkund. This is also where you have to pay the valley of flowers national park entry fee. Yes...

valley of flowers: part II

Image
Day 2, Sun Aug 24 : After spending a good night in Joshimath, time was now to further our journey . Our day started early. We got up at 6 and had checked out of the TRH by 7:30 am. Plan was to take some mode of transportation till Govindghat. From there we were to start our first trek, to Ghangharia. We got a jeep for Govindghat from Badrinath taxi stand in Joshimath. After a drive of less than an hour, the jeep dropped us just at the border of Govindghat. From the road itself, we could see Laxman Ganga, river that flows from glaciers beyond Hemkund, falling into Alaknanda. After walking for about 10-15 min, we reached our trek start point. By the way, our cellphones had stopped working as soon as we left Joshimath, so luckily we were unreachable now and we remained so till the end of our trip. We hired a porter for our luggage here (for Rs. 405). Though there are lockers available in Govindghat for luggage, we didn't want to leave anything behind as we were going to be in Ghanghar...

valley of flowers: part I

Image
Last year, after our Ladakh trip itself we had decided that our next trip would be to Valley of Flowers - a national park, nestled high in the lap of western Himalayas. It's in the north-east corner of Garhwal region of Uttarakhand state, near the holy town of Badrinath . As reaching the valley requires a trek of more than 17 km, and then there is a trek of Hemkund Sahib nearby that you wouldn't want to miss, it was essentially going to be a trekking trip . Though we wanted to do this trip since last year, ideal time was the constraint. Ideal time to visit the valley is mid-July to August as that's the time when flowers are in full bloom. We decided to do the trip in the last week of August (Aug 23 - Aug 31). There was not much to be planned for this trip as itinerary in these parts of Himalayas is pretty much decided by the moods of the mountains. This region is particularly infamous for landslides. So, we only thought about the going part. Now, since scope of luxuri...

pactester for Windows

Lately, I have been getting some queries for "test pac files on windows", "pactester for windows" etc in website access logs and emails. Compiling pactester on Windows, though possible, is quite a complicated process. So much so that it's almost impractical to ask users to do so. Since it's a perl script, packaging it for Windows is even more difficult. To avoid packaging difficulties of perl code and now that pacparser is there, I think it makes sense to implement pactester using pacparser. That's exactly what I did in last couple of days, implemented pactester in C using pacparser library. I have compiled it for Windows and uploaded zipped binaries on pactester downloads page: http://code.google.com/p/pactester/downloads/list Also, to simplify things and as an added bonus to pacparser users, I have decided to distribute this version of pactester (implemented in C using pacparser API) along with pacparser from next release. Thanks to open source that...

pacparser - a library to parse PAC files

As I mentioned earlier also, proxy auto-config (PAC) files are becoming more and more important for web proxy usage because of automation and ease of administration provided by them. Almost all popular browsers today support them. But, there is still a dearth of tools available for processing PAC files e.g. popular web software like curl, wget and python-urllib still don't take PAC file for proxy configuration. That was the problem I wanted to solve when I started to work on pacparser. Now it's ready in full glory - http://code.google.com/p/pacparser . From the release announcement: I am very pleased to announce the release of "pacparser" - a C library to parse proxy auto-config (PAC) scripts. Needless to say, PAC files are now a widely accepted method for proxy configuration management and almost all popular browsers support them. The idea behind pacparser is to make it easy to add this PAC file parsing capability to other programs. It comes as a shared C library ...

ladakh, land of peace and quiet - part II

Image
Time to continue the Ladakh story started in the last post . So we reached our guest house in Leh on Monday night at around 10 PM. Pankaj was bowled over by the beautiful smile of the receptionist and manager of the guest house, a simple country girl. Actually, she was cute :) She was daughter of the guest house owner. The whole guest house was run by family people only - gardening, managing, cooking, cleaning everything. The people there were really nice. They cooked food just for us even though the regular dinner time was already over. We had a good sleep that night. Next morning, after having Ladakhi breakfast (ladakhi bread, honey jam and butter), we went out to see Leh. Main market was about 20 min away from the guest house and the whole route was filled with the handicraft shops and scenic views on both the sides. We had lunch there in the market itself and came back. Then we again slept off in the afternoon. The 2-days travel was showing up on us finally. In the evening, we ...

ladakh, land of peace and quiet - part I

Image
Have you ever felt the power of space? When you feel that the space, just space around you, affects you strongly. Almost all of us have experienced it for short duration in some way or other, for example when we go to a temple. I felt it for a much longer duration. It happened to us when we visited Ladakh last month. By we, I mean Pankaj and I. For those who don't know, Pankaj and I are best buddies. So, we went to this land of peace and quiet. There are some obvious things that make Ladakh different from all other hill stations. Altitude so high that AMS (Acute Mountain Sickness) comes to you easily, different kind of people, and proximity to both Pakistan and China borders. But, there are some things which are not easy to imagine. Things like how can it calm you beyond your imagination. We were very excited about this trip. We decided to go by Manali-Leh road and come back by air. Our route was something like: Hyderabad -> Delhi -> Chandigarh -> Manali -> Leh -...

Hacking squid

In this post, I would like to talk about the recent fun I had with squid . It involved some troubleshooting and some hacking. Problem: Squid will stop responding after running for some random period of time, say 10 to 40 min and cpu usage will shoot up to 95-100%. I started with strace , but everything looked fine there. Then I tried ltrace and there I got the first clue. squid was comparing 2 strings in an infinite loop: strcmp("thumbnail.videoegg.com", "i12.ebaystatic.com") = -1 strcmp("thumbnail.videoegg.com", "i12.ebaystatic.com") = -1 strcmp("thumbnail.videoegg.com", "i12.ebaystatic.com") = -1 Looks like some bad 'for' loop. But, what part of code and why? It needed little more debugging to answer these questions. The squid binary that I was running was installed from a debian package and thus was stripped off debugging symbols. To fix that problem, I rebuilt the squid package with debugging information. On ...

Real Tail'ing in Python

or, finding last few lines in a file. Ok. So, last solution was not perfect. It just returned last line from a file. What about returning say 10 or may be more lines? Here is the modified Tail function to do that: def Tail(filepath, nol=10, read_size=1024): """ This function returns the last line of a file. Args: filepath: path to file nol: number of lines to print read_size: data is read in chunks of this size (optional, default=1024) Raises: IOError if file cannot be processed. """ f = open(filepath, 'rU') # U is to open it with Universal newline support offset = read_size f.seek(0, 2) file_size = f.tell() while 1: if file_size offset = file_size f.seek(-1*offset, 2) read_str = f.read(offset) # Remove newline at the end if read_str[offset - 1] == '\n': read_str = read_str[:-1] lines = read_str.split('\n') if len(lines) >= nol: # Got nol lines ...