Rewrite and Makeover


I've been neglecting my own site for too long, so here's an update and some more.

As an afternoon project and a break from working on Picsna, I decided to rewrite and give this site a complete makeover. It's written in Python on Pylons, and I ditched MySQL in favor of MongoDB. This is the same stack I am using for a bunch of other projects including Picsna, and so far I am loving it. I highly recommend you check out Pylons + MongoDB if you haven't already: it's simple, fast, elegant and just a joy to work.

It's interesting to look back at the evolution of this site, starting from bunch of static html pages way back in 2002 on a TK domain, then to a flash based site, next to Wordpress, after that to a custom PHP site, and finally to this version. Now I just need to write more and better content.


Easy life with SSH Configs


If you are ssh'ing constantly to a lot of boxes using long ssh commands with many switches, you are doing it wrong. Make your life easier with the ssh config file (~/.ssh/config)

Host home home.example.com
    HostName home.example.com
    User j
    Port 12345
    LocalForward 45901 localhost:5901
    LocalForward 40080 localhost:80

Now all you need to do is "ssh home" and it will connect using those options. That easy. All the options can be found in ssh_config(5)

Better yet, the Host option can contain wildcards, so you can set common options for sets of domains. I use it extensively when logging in to Amazon EC2 machines.

Host *amazonaws*
    IdentityFile ~/.ssh/your_ec2_key.pem
    User root

Now all you need to do is "ssh blah-1-2-3-4.ec2.amazonaws.blah.com" and it will connect using your EC2 private key as root.

Another great usage is if you constantly vnc in to your home computer remotely through ssh tunnels. Usually you set up a ssh with a local forward, then fire up vnc manually. Well now you can do it in one command.

Host remote
    Hostname home.example.com
    User someuser
    Port 12345

    LocalForward 59999 localhost:5901
    ExifOnForwardFailure yes

    PermitLocalCommand yes
    LocalCOmmand vncviewer localhost:59999 &>2 &

So now you just simply type "ssh remote" and it will set up the tunnel and pop up the vnc window. Enjoy!


Twitter and URL Shortening Services


Lately, all my primary technology news sources have been polluted with articles about Twitter and URL shortening services. A part of my dies inside every time I hear about one of these. I can understand the hype about Twitter, but the only reason there is a hype about URL shortening is because of Twitter.

I have an open suggestion to Twitter that would benefit them, their user base, and hopefully kill the URL Shortening market space in one go. (so it would be one less thing to pollute my daily tech news with).

Solution

Twitter, implement your own shortening service and integrate it with the service. There is #hashtags, and there is @mentions. Using the same convention and use either ! % or ^ to implement URL redirection.

Example

"Hey @person, go check out ^s89n3"

If a user wants to shorten the url http://www.janitha.com, the service would map that url to a code such as "1a2b3c". Now if a user enters ^1a2b3c, it links directly to the original URL (or links to something like http://www.twitter.com/redir/1a2b3c that redirects to the correct place). It's really trivial, everyone and their grandmother is implementing URL Shortening services, so I am sure you can spare a fraction of your millions in funding to implement this simple feature.


Listen to your Feeds


Last night I was wondering how interesting it would be to have your friends Facebook status updates, twitter tweets, and other types of live feeds be read back as speech in real time as they are updated.

A coffee cup later, jFeedSpeak was written. It's a Feed-to-Speech script I wrote in python and it accepts any number of RSS feeds (facebook status updates, twitter, Google news, pretty much any RSS you throw at it). The newest updates are piped in to Festival (Text to Speech engine) which you can listen to (and optionally pynotify that pops up a notification, but I commented that out for compatibility).

The default script uses the Twitter public feed, but it can become really annoying, so I highly suggest you modify and add more personalized feeds to it. Instructions and configuration inside the script. Enjoy!

Download jFeedSpeak


Telephone Number Geocoder


Want to map out a whole bunch of telephone numbers by their location?

Telephone Number GeoCoder

That was my Sunday afternoon project. Inspired by @joshuabaer's tweet looking for such service, decided to implement one just for fun today. Sorting through the data was fun, loads of wget, bash scripts to cut, awk, grep and process, python to mix and match, some php to whip out a interface, and sweet little mysql db to store it all.

It has a resolution per city using area code & prefix (123-123-....), and it turns out the US has a total of 155,972 unique geographically based telephone sectors.

You can feed it a list of phone numbers in any order, or even a chunk of text with phone numbers inside it and it will try it's best to extract all the valid phone numbers. Valid formats include 1231231234, 123-123-1234, (123)123-1234, 123.123.1234, etc... yay for regular expressions.

I need to start using the google maps api more frequently, maybe next weekend project.

Update Dec 4, 2009: The Telmapper was taken down due to Abuse.


A New Captcha


I was tired of seeing the same variety of CAPTCHA systems online that consist mainly of letters and numbers. These have gotten so complex, they are close to impossible for even humans to guess. Since my new site needed a captcha system to stop the comment spam, I decided to write my own captcha just for fun, except instead of letters, using shapes. It's very simple, yet quite effective (no spam comments since I launched, compared to several hundred spam comments with the last wordpress with a conventional captcha system).




The current version uses circles and boxes and prompts the user to enter the count. The shape overlaps and deformations make it pretty hard for a bot to guess (but not impossible). Compared to a using a regular captcha, the biggest strength in rolling your own captcha is that no one would try to create a bot or find a already existing one to break that since the captcha system is rare (such as this one). Security through obscurity in a way. So if you have a big comment spam problem, and have a hour or two to spare, I would highly recommend you create your own captcha variant.

When you are developing your own, make sure to bind the corresponding captcha image to the session, ip, unique key, and what ever else you want and make sure to have a expiration method as well as have a failure threshold to thwart brute force attacks.

My Captcha in Action

Update Dec 4, 2009: I migrated the comment system to Disqus, so this is not available on my site any more. Disqus is taking care of the spam/bot issues for me now on.


Don't Steal My Laptop


So lately I've been hanging out a lot at Coffee Station and on campus using my Laptop. Doing this, one of the biggest annoyances I had was whenever I had to leave the area to get a coffee or something, I risk leaving the Laptop unattended. Using a cable lock every time was annoying, so instead I wrote a anti theft alarm script that utilizes the Laptop's built in accelerometer. Originally it's meant to be used for the HDAPS, or Hard Disk Active Protection System, to detect shock and prevent data corruption, but I will be using it for a different purpose. Here is a demo video...



This is how it works. Whenever I am about to leave the laptop, I start the script which locks the laptop and start the gnome screensaver. Any small bumps or tilting up to 20 degrees of the laptop will produce a small chirp sound where the volume is directly proportional to how tilted it is (so the more you tilt it, the more loud it becomes) as a initial warning to anyone who bumps or laptop or for small movements. Any movement beyond 20 degrees of tilt will start the alarm at the highest volume (and the ThinkPad speakers are Loud). The script monitors the gnome screensaver status, so the only way to stop the alarm or to unarm the system is to log in using the password or a finger swipe which the gnome screensaver.

If you want to get this working on your linux laptop, make sure you have HDAPS on your laptop and Tp_smapi installed. There are other anti theft implementations that use the HDAPS data you can find here, but none of them integrated well with the gnome screensaver or have the initial warning feature. That's all for now, hope you found this useful.

Script Source

Update Nov 8, 2008: A variation of this same script for Kubuntu/KDE written by Colin Verot.


Newer Posts

Older Posts

Navigate

Archives