/images/bio-photo-small.jpg

Shallow and Pedantic

A person/tech/code blog of a coder/techie/person. Like calculus in a kiddie pool, the author of this blog is known to be quite shallow and pedantic.

Automatically starting rtorrent within screen

These days I don’t stay at home often, but I do have an RSS/BitTorrent combo fetching me all kinds of neat stuff for me, so I can have it ready for me on the weekend. I love rtorrent, especially due to the fact that I can run it in screen, ssh home and see how things are doing (or add more torrent to the download). However, sometimes my net connection breaks down, computers gets shut off, or things like that.

Quick time tracking hack

Gnome 2.24 adds a new Time Tracking feature, which I would have found useful. I don’t have Gnome 2.24 at work, but I do have a Unix-based operating system… Here’s my new ~/bin/track: 1 2 3 #!/bin/bash date >> ~/time_tracking vim ~/time_tracking + Now, if I could only get vim to automatically hit “A” and space for me afterwards… (I’m betting there’s a way to do it, but AFAIK vim can only receive ex-mode commands as parameters).

Delegating methods in Ruby

Sometimes, when constructing a compound object, we are interested in exporting functionality while retaining encapsulation. For example, suppose we have a Secretary class: 1 2 3 4 5 6 7 8 9 10 11 class Secretary def send_fax(destination, fax_contents) puts 'Sending fax "%s" to %s' % [fax_contents, destination] end def answer_call(call) # ... end # ... end Our Secretary provides a lot of useful functionality, that our Boss class would like to have.

Tracking TTime

Ditz was lost in the mists of time, and I guess if ttime were maintained, issues would be tracked using Github. I’ve added issue tracking for ttime using the fantastic ditz. I’ve also added ttime’s rdoc documentation. (Note: Version 0.8.5 is out)

Three things I didn't know Ruby does

Edit: I was misled! Illustrated here. Hints below. >> def inspect_x_and_y(x,y); puts "x: %p, y: %p" % [x, y]; end => nil >> inspect_x_and_y(y={"hello" => "world"},x=[1,2,3]) x: {"hello"=>"world"}, y: [1, 2, 3] The bits I didn’t know about: "Format strings using a %% sign, %s, %s!" % [ "just like in python", "but with arrays" ] The %p formatting character is the same as inspect. You can call methods with method_name(param2=val2, param1=val1), also like in python.

Security project

This site gets indexed by the almighty google. This link is part of a security project I’m doing for my CS degree. The was part of project BadSense. See the BadSense report