Follow me on Twitter for my latest adventures!

Here is something neat that I hacked together - a `top' like Python program (called Hacker Top) to follow the Hacker News from the console!
Hacker News has become the 2nd source for news after programming.reddit for me. I have a couple of ideas for a startup myself and the tips I get from Hacker News are priceless.
If you have never heard of Hacker News, I suggest you visit the site (http://news.ycombinator.com/). It's a Digg/Reddit like social news site for startup founders and hackers created by Paul Graham.
This program works ideally for me. I spend lots of hours hacking away at my shell and all I have to do is switch the terminals to the one running the Hacker Top program to get the latest stories!
Here is a screenshot of the program running:
Download
Download link: hacker top program
Downloaded: 4414 times
Note - this program is released under GNU GPL.
How to run the program?
1) Make sure you are running a Unix type operating system.
2) Make sure you have Python installed. Any recent version will do.
3) Download and unpack the hacker top program archive.
$ wget 'http://www.catonmat.net/download/hacker-top.tgz' $ tar -xvzf hacker-top.tgz
4) Change to 'hacker-top' directory which was created by unpacking the archive.
$ cd hacker-top
5) Give the 'hacker_top.py' program execute permissions.
$ chmod u+x hacker_top.py
6) Run the hacker_top.py program.
$ ./hacker_top.py
(If that does not work out, try running 'python ./hacker_top.py')
Also make sure your terminal is at least 80 columns wide, otherwise the program won't be able to display the results nicely.
Command Line Options
If you run the program with '--help' argument, it will display the possible command line options:
Usage: ./hacker_top.py [-h|--help] - displays this
Usage: ./hacker_top.py [-i|--interval interval]
[-u|--utf8 <on|off>] [-n|--new]
As the help message suggests, the three main options are:
-i or --interval, which specifies refresh interval.
The default refresh interval is 3 minutes. Here are a few examples: 10s (10 seconds), 12m (12 minutes), 2h (2 hours).
-u or --utf8, turns on utf8 output mode.
Default: off. Use this if you know for sure that your terminal supports it, otherwise you might get gibberish.
-n or --new, which follows only the newest hacker stories.
Default: follow front page stories.
Keyboard Shortcuts
There are several keyboard shortcuts which you should know about when using the Hacker Top program:
- q - quits the program.
- u - forces an update of the news.
- up arrow/down arrow (or alternatively j/k keys) - scrolls the news list up or down.
- m - changes the display mode. There are 5 different display modes for your taste.
Enjoy the program! I'll write some details how I created it in one of the next posts. Stay tuned - subscribe to my rss feed! :)
Download Hacker Top Program
Download link: hacker top program
Downloaded: 4414 times
The program is released under GNU General Public License.
ps. Be sure to read Hacker News Guidelines and FAQ if you decide to join the hacker community and star submitting interesting hacker news.



Facebook
Plurk
more
GitHub
LinkedIn
FriendFeed
Google Plus
Amazon wish list
Comments
Thoughts on what I'm doing wrong?
StammyAir:hacker-top Paul$ ./hacker_top.py Traceback (most recent call last): File "./hacker_top.py", line 669, in curses.wrapper(interface.init_and_run) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/curses/wrapper.py", line 44, in wrapper return func(stdscr, *args, **kwds) File "./hacker_top.py", line 353, in init_and_run curses.curs_set(0) _curses.error: curs_set() returned ERRPaul, I never thought it would raise an exception there on a Mac.
I just fixed it. Can you please try downloading again?
Works now! thanks.
Awesome :)
great little app!
Is a way to choose a link and open the browser?
just one correction-
change hacker_top to hacker-top in your instructions.
Just installed python2.5 for the first time (I'm a linux newbie) - getting an error - No module named Queue - any ideas?
orne, fixed, thanks! Unfortunately there is no way to click the link as it's a console program.
Ben, it should work! Queue is in Python 2.5. I suspect you have a broken Python installation!
Great work! Congrats on graduating! Don't be disheartended by MIT, you can always apply again.
It seems like this would be bad for my productivity.
Awesome app! Can you add the ability to view the comment threads and also open the links in articles. Haha maybe with lynx ;)?
Daniel, well, it's not that bad for productivity. I have been using it for a couple of days and it has not hurt me. :)
Matthew, yes, perhaps I can. But now I am working on something else. I'll add it some time later.
Babul, I need to do something extraordinary before I reapply. Otherwise I stand no chance to get in.
Great app. Suggest to add ability to display reddit (incl. communities). Isn't BeautifulSoup the greatest thing since sliced bread?
/mac
YCombinator News command line search is available by accessing http://news.ycombinator.com/item?id=184707
you can pass "open 'http://apple.com'" for example to command line to launch a browser to the url.
using os module
system("open '%s'" % url)
I created a similar tool in Ruby to help me with my HN newsletter, but never thought of modeling the 'top' interface... great idea and that makes it very easy to use. Makes me wonder what other things could use the same presentation style.
Leave a new comment