Daily Archive for September 14th, 2008

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.