Archive for September, 2008

Why I maintain a weblog

I started posting to this website a little over two years ago. Considering the average age of weblogs is around four or five months before it’s abandoned, this one’s a rebellious teenager in blog-years. The intensions of mine at that time was to spread opinions, news, and reviews. Now, two years down, I keep my opinions to myself, if I even bother forming one. I couldn’t care about news and reviews and despise those sort of publishing joints.

When a friend of mine tried to take down her website and disappear forever, after moving, erasing and changing her stance on her weblog quite a few times. I felt similarly too, once upon a time. Partly because I get these mad itches to change things. Sudden pangs to move to a different weblog engine, to design a theme from scratch, and even the desire to change the entire direction, and cull all the posts that don’t fit the direction.

Then the logical, and surprisingly minimalist side of me asks: Why? Why break something that’s been working fine? And I cannot respond.

The most beautiful part, as I now realize, is to be able to look back on yourself, like a time capsule. For some reason, I have a very very weak memory. I frequenty encounter things that I did not fully remember doing (for example, I found out I own ninjagod.com ), and it feels nice to remember what I felt during certain periods of time.

But the most important thing is this:
My main goal in life is to grow and change for the better. And this weblog seems to be physical proof that I have.

Be it the style, or content of writing. Be it how busy I am to post things, or simply how clever the quips are, the proof is in the utf-8 encoded pudding.

My keyboard works! I am so happy

A few days back, my comparitively expensive natural keyboard went bust. Today, once the exams were done, I got back and washed the plastic sheets, and reassembled the entire thing. It worked better than ever.

Now to get back to getting used to natural keyboards. Meanwhile I’ll be writing a lot of letters today. Snail mail is a lot of fun. To top it off the exams didn’t go too shabby either!

I’m gonna get started on a new linux client exclusively for wordpress. I’m building a solid framework for queing generic xml-rpc requests to the exclusive Wordpress API, allowing for client side comment moderation and will work with wordpress 2.7 only. Since I’m working with the wordpress head revision it’s pretty interesting to see how the API will evolve and the stubs will get implemented.
Geez, my typing speed has doubled with my regular keyboard. For a moment there, I was terrified I’d lost it completely.

Update: Keyboard stopped working again. So much for the only microsoft product on my machine now.

Keyboard update

I got back to my keyboard in the evening, and unscrewed the back and exposed the innards. I seem to understand part of the working quite well, atleast how the button presses. I found the liquid that seemed to be causing the problem and fixed that.

I put it back together and it stopped working altogether. If it’s not a problem with the chip, the internet might help me fix the keyboard, especially this one: http://www.rabidhardware.net/index.php?id=9

Till the weekend, when I will attempt to do whatever I need to bring it back to life, I shall use the regular keyboard, and I still haven’t gotten used to it :(

My keyboard died on me :(

I woke up this morning and found that one of my keys were printing two letters. ‘v’ was printing ‘bv’ and so on. Turns out my keyboard was a little wet. I don’t know how. It worked fine last night, but now everything’s utter chaos.

It was a microsoft natural keyboard elite btw, quite expensive, but awesome.

I moved back to my old keyboard right after, and since the spacing of the keys aren’t right, I can’t type a single word in clean. I now miss my awesome keyboard, and realize how important it was, and more dangerously, how incapable I am of typing on a regular keyboard anymore.

I didn’t think there was any liquid there. Maybe some insect went into the circuitry. Nevertheless, I’ll have a look after my exams get over. I miss my keyboard :(

A very scary potential paypal exploit.

I’m publishing this in hopes that it’ll be useful.

Consider the paypal phishing case. Someone sends an email citing a reason why you need to Log into paypal to verify your funds. You usually recognize this as a false alert.

Now consider this scenario. You find an item which is extremely well priced, and you want to buy it. It only costs three dollars when it’s actually worth thirty. You click “Buy”, enter your password in the paypal window (which usually is secure), and hope to get your product.

What you might not know is that, this is an ideal case for phishing. Anyone can replicate the paypal page, and a lot of people might not notice before entering their password.

Even worse, the malicious site can open up the page in an internal frame (thereby making it clever and ajaxy looking effect, while effectively preventing the user from seeing the page).

This is just social engineering and I am not aware of such a trick plaguing paypal.

What paypal can do to prevent this is to ask each user to verify “YES! this is the actual paypal address”, before entering the information. If the user doesen’t agree, the transaction is terminated.

Post to tumblr using vim

I wrote this script today morning before breakfast. It allows you to post to tumblr using the console. It’ll fire up vim to write a new post, and accepts markdown. If you don’t like vim, go away.

Here’s a snippet from the code. I’m testing out the new syntax highlighting system.

[sourcecode language="python"]

# Instructions on how to use this file:
# Step 1: set tumblr_email and password

# Step 2: go to terminal, enter the two commands:
# chmod +x tumblrpost.py
# sudo cp tumblrpost.py /usr/bin

# Step 3: Run tumblrpost.py from anywhere
# You can use markdown to format your posts.
# Ignore any errors. The post will still happen. Python seems to raise
# errors with response code 201 is encountered

# CHANGELOG:
# ==========
# Version 0.1: Initial console version supporting regular posts

import urllib, urllib2, os, subprocess

#TODO (user): SET THESE PARAMETERS
tumblr_email = ”
tumblr_password = ”

if __name__ == “__main__”:
# Let’s support only regular posts for now, but allow commandline
# params to set post type later on. (like links, etc)
post_type = ‘regular’
if post_type == ‘regular’:
post_title=raw_input(”Enter the title”)
# Create a file for the body.
filename = “post.txt”
editor = “vim”

[/sourcecode]
Anyways, you can see the full source code and download it here: http://code.google.com/p/proto-code-dump/source/browse/trunk/py/misc/tumblrpost.py

I’ll put my code on that repository, so if you want to get all my code, you can checkout the subversion repository:

http://proto-code-dump.googlecode.com/svn/trunk/

In the name of productivity…

I saw sindhu’s post on “Real programmers”, and it made me think and want to write something until the library opens in fifteen minutes, when I leave.

Till today, I’ve seen one programmer who I respect beyond anyone else. He was around 25 or 26. He used to have two or three terminal windows open on a 30 inch monitor, wrote code with vim with barely any syntax highlighting. He was always ready to help you, would listen to your problem, no matter how busy he was. At the end of my internship, my project came to around 5000 lines of code. It was large, and didn’t do too much, and was rather hard to write. I was proud and asked him how much code he usually writes.

In one quarter, he wrote 36000 lines of code. *36000*.

That put productivity in perspective for me. There is only so much tools can do for you. At the end of the day, the real professionals work with what they have, and that’s usually very little and do wonders with it.

The greatest programmers, the greatest leaders of open-source who’ve contributed more to the community than most people contribute to the companies that pay them. None of them seek any kind of credit, any kind of extra recognition. Heck, most people don’t even have a website.

I feel productivity is a farce. I define productivity like this: tasks that need to be automated, and can be automated. For example, you can’t automate the code one writes, but you can use an editor that indents the code, because that can be automated, and is required quite frequently.

Do not interpret this thinking that I’m only interested in you if you write behemoth amounts of source? Do I think that me or the kind of people I mentioned here are better than everyone? No.

The lifehacker generation will continue to live on with their little “productivity tools”, while the real heroes do magic with an 80×25 terminal.

In one line: I respect people who do more than they talk about doing.

LinuxDC++ Voyeur edition + webapp.

I’m dumping the source for the dc++ voyeur edition which caused quite a bit of privacy fears. I do not endorse it’s usage, and am distributing it in the hopes that it’s useful.

I trimmed down the hacks to the main codebase, using the internal logging engine (which is pretty nice and asynchronous) in the place of my previous self-written stdio file writing engine.

How to use this:
Compile using scons, like regular linuxdcpp (I won’t go verbose as to how), and just run it. Make sure that you enable the logging for system events. (Preferences -> Logs -> Log system messages).

In ~/.dc++/Logs/system.log, messages will be written like:

[2008-09-07 15:35] [SEARCH] {IP:{10.255.255.255:4242}} {QUERY:{James$Bond}}
[2008-09-08 12:57] [LOGIN] {NICK{enpower}} {IP{10.255.255.255}}
[2008-09-08 12:57] [LOGOUT] {NICK{enpower}} {IP{10.255.255.255}}

You can use anything to process the logs. If you’re the hardcore unix types, use sed or awk. Or if you have a python fetish, you can see what I’ve done here. (This is part of a script for a django app, so it won’t work standalone)


#!/usr/bin/python
# indexlogs.py : Index the logs of custom linuxdc++ and add them to the django db
# Author: Anirudh Sanjeev (anirudh at anirudhsanjeev dot org)

from django.core.management import setup_environ
import settings
setup_environ(settings)

from dctrends.searchtrends.models import Event, Search
import datetime, sys
import logging, re

# Create a logger
logger = logging.getLogger("main_logger")
logger.setLevel(logging.DEBUG)
# Create a console handler
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
# Create a formatter
formatter = logging.Formatter("%(asctime)s - %(message)s")
ch.setFormatter(formatter)
logger.addHandler(ch)

# Create a logging object
LOG = logger.info

# Get the log path
logpath = "/home/anirudh/.dc++/Logs/system.log"
line_num = 0
max_lines = 100 # Redundant. For debugging purposes only.
logfile = open(logpath)
searchre = re.compile("SEARCH")
ipre = re.compile("\{IP:\{.*:[0-9]*\}\}")
queryre = re.compile("\{QUERY:\{.*\}\}")

for line in logfile:
	if(searchre.search(line)):
		if not ipre.search(line):
			continue
		if not queryre.search(line):
			continue
		iptext = ipre.search(line).group()
		iptext = iptext[5:len(iptext)-2]
		query = queryre.search(line).group()
		query = query[8:len(query)-2]
		if len(query) > 48: # Prevent really long strings
			continue
		iptext = re.compile(":").split(iptext)[0]
		query = re.compile("\$").subn(" ", query)[0]
		# query contains the query text
		# iptext contains the ip address
		s = Search()
		s.query = query
		s.origin = iptext
		s.timestamp = datetime.datetime.now()
		s.hall = 111
		s.type = 1

		LOG("Saving: %s from %s",query, iptext)
		s.save()

So anyways, you can download it here.

Unpublished

Today was among the few times I pissed off the general public. Essentially, I modified a filesharing client to log all incoming searches.

Over time, I had a large log of data about what people are searching for. People were blissfully unaware about how their privacy was violated when they searched on filesharing client.

After logging searches for a week, I spent an hour writing python scripts and a django application, which checks the intranet IP of the visitor and displays all the terms he/she’d searched for, and displayed it on a html page.

Rest assured, people were pissed. Really pissed.

Mainly because most of the searches were for objectionable content, and to have your obscene searches staring you in the face is really freaky, or so they say.

At the end it was a brilliant project. A very small, but extremely powerful and dangerous webpage, exposing just how ridiculously poor their knowledge of privacy is.

I pulled the page down, and removed the indexes and logs. I do not wish to possess such power. Moreover, I’m not the voyeur type. I don’t like to go and see what people are searching for.

In the long term perhaps, it’ll evolve into something like Google Trends, where I can see search volume and graph it to get insight about the people in the institute. I keep realizing the incredible power of Python and the Django framework, which I used to write the application.

Because I watched half an hour of “The dark knight” before I worked on this, I started realizing the burden of being able to do something and not being able to show the world.

I need to get some sleep :\

Jaunty Whatthefudgealope?

Apparently the Ubuntu version 9.04 will be called “Jaunty Jackalope”.

That’s f**ing retarded.

Why? Imagine a conversation going like:
“Hey, if vista’s not stratchin’ your itch, you’ve got to give ol’ jackalope a try”.
“what-a-lope?”
“jackalope. It’s a cross between a jackrabbit and an antelope”
“I think I’ll pass”

I was initially pissed when Intrepid became a three-syllable term, thus breaking a line of two syllable names.

But I hope to god, they don’t give Linus Trovalds the honor of naming version 10.10.
(Hint: version 10.10 will begin with an M)