The limits of tolerance

As I observed the ugly events of Friday, I had trouble swallowing the argument that all sides were plain wrong. To my mind it was the MB who was the instigator in all of this. Their thuggery, dishonesty, and their relentless desire to fully appropriate Tahrir is the primary cause of clashes.

Intolerance exists in every faction, but more so amongst those who claim to have a divine mission. They see those who disagree with them as apostates. Liberals, on the hand, have no problem with what others think or believe so long as they do not trespass on their own rights.

The recent conflagration was primarily about the MB trying to restrict the rights of others to object. It started there and ugliness on all sides ensued. I hoped that the battle for the constitution would be carried out through rational debate. I see now that there many religious conservatives would rather conduct this battle via a street fight.

The tectonic plates of modern Egyptian culture have collided at Tahrir. The stresses are building and left to its own devices, an Earthquake in bound to ensue. In their voracious pursuit of power and hegemony, the MB have effectively killed  the cross cultural/class dialog that characterized the early days of the revolution.


Using Python and wget to download certain file types from a web-page

Recently I wanted to download all the movies in Mackay’s information theory course. That was a great deal of files and I though it would too tedious to try to do it using the browser or even manual wget. So digging around, I found this decent tutorial on python HTML processing. I also dug around some information on parsing URLs. I combined that with my knowledge of python’s subprocess and put together this nice piece of code.



import sgmllib

class MyParser(sgmllib.SGMLParser):
"A simple parser class."

def parse(self, s):
"Parse the given string 's'."

def __init__(self, verbose=0):
"Initialise an object, passing 'verbose' to the superclass."

sgmllib.SGMLParser.__init__(self, verbose)
self.hyperlinks = []

def start_a(self, attributes):
"Process a hyperlink and its 'attributes'."

for name, value in attributes:
if name == "href":

def get_hyperlinks(self):
"Return the list of hyperlinks."

return self.hyperlinks

import urllib, sgmllib

# Get something to work with.
f = urllib.urlopen(webPage)
s = f.read()

# Try and process the page.
# The class should have been defined first, remember.
myparser = MyParser()

# Get the hyperlinks.
print links

movies=[x for x in links if x.endswith('mp4')]
print movies

import urlparse
movieURLs=[urlparse.urljoin(webPage,x) for x in movies]
print movieURLs

from subprocess import call

for movieURL in movieURLs:
call(["wget -c "+movieURL],shell=True)