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: 1002 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 ] [-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 link: hacker top program
Downloaded: 1002 times
The program is released under GNU General Public License.
Discuss it on catonmat forums!
ps. Be sure to read Hacker News Guidelines and FAQ if you decide to join the hacker community and star submitting interesting hacker news.


|
|
|


July 8th, 2008 at 4:30 am
[…] BeautifulSoup - for parsing HTML. The development process of the program is described on my blog: Follow Hacker News from the Console The program is released under GNU GPL license. If you want to discuss how it was designed, or […]
July 8th, 2008 at 5:53 am
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 ERRJuly 8th, 2008 at 5:57 am
Paul, I never thought it would raise an exception there on a Mac.
I just fixed it. Can you please try downloading again?
July 8th, 2008 at 6:02 am
Works now! thanks.
July 8th, 2008 at 6:04 am
Awesome
July 8th, 2008 at 6:30 am
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.
July 8th, 2008 at 7:24 am
Just installed python2.5 for the first time (I’m a linux newbie) - getting an error - No module named Queue - any ideas?
July 8th, 2008 at 10:26 am
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!
July 8th, 2008 at 1:38 pm
Great work! Congrats on graduating! Don’t be disheartended by MIT, you can always apply again.
July 8th, 2008 at 3:34 pm
It seems like this would be bad for my productivity.
July 8th, 2008 at 3:49 pm
Awesome app! Can you add the ability to view the comment threads and also open the links in articles. Haha maybe with lynx ;)?
July 8th, 2008 at 4:17 pm
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.
July 8th, 2008 at 11:30 pm
Great app. Suggest to add ability to display reddit (incl. communities). Isn’t BeautifulSoup the greatest thing since sliced bread?
/mac
July 9th, 2008 at 1:32 pm
[…] Follow Hacker News from the Console - good coders code, great reuse […]
July 9th, 2008 at 3:14 pm
YCombinator News command line search is available by accessing http://news.ycombinator.com/item?id=184707
July 10th, 2008 at 7:01 am
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)
July 14th, 2008 at 10:54 pm
[…] Top I just modified Hacker Top program to display stories from Reddit. The new program is called Reddit Top. The program is also […]
July 14th, 2008 at 11:17 pm
[…] week I published the Hacker Top program and promised to explain how it was made. Before I do that, let me publish another similar […]
July 24th, 2008 at 10:38 am
[…] the last fortnight I have released two top-like applications to follow Reddit and Hacker News from the console. I received a few emails and comments asking me to explain how the applications […]