hacker news, ycombinator logo

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:

hacker top, detailed mode
Try the 'm' keyboard shortcut to change display modes!

Download

Download link: hacker top program
Downloaded: 5610 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: 5610 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.

Comments

July 08, 2008, 05:53

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 ERR
July 08, 2008, 05:57

Paul, I never thought it would raise an exception there on a Mac.

I just fixed it. Can you please try downloading again?

July 08, 2008, 06:02

Works now! thanks.

July 08, 2008, 06:04

Awesome :)

oren Permalink
July 08, 2008, 06:30

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.

Ben Permalink
July 08, 2008, 07:24

Just installed python2.5 for the first time (I'm a linux newbie) - getting an error - No module named Queue - any ideas?

July 08, 2008, 10:26

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!

Babul Permalink
July 08, 2008, 13:38

Great work! Congrats on graduating! Don't be disheartended by MIT, you can always apply again.

July 08, 2008, 15:34

It seems like this would be bad for my productivity.

Matthew Kanwisher Permalink
July 08, 2008, 15:49

Awesome app! Can you add the ability to view the comment threads and also open the links in articles. Haha maybe with lynx ;)?

July 08, 2008, 16:17

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.

Martin Permalink
July 08, 2008, 23:30

Great app. Suggest to add ability to display reddit (incl. communities). Isn't BeautifulSoup the greatest thing since sliced bread?

/mac

July 09, 2008, 15:14

YCombinator News command line search is available by accessing http://news.ycombinator.com/item?id=184707

July 10, 2008, 07:01

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 13, 2010, 00:50

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.

jerryzhou Permalink
August 30, 2013, 11:56

hi what version of linux do you like best ?debian or slackware ?how to build a web under slackware

cdl4sure Permalink
April 08, 2014, 11:21

Commercial drivers license is required to operate any kind of vehicle which has a gross weight of 26,001 lbs or more. The number of heavy vehicle drivers is expected to increase 14 percent by 2018, so it is very important that you get into this field on first convenience. The bright side of this career is that employment of light and heavy trucking is going to increase 4% by 2018. Average salary of a truck driver is around 36,000 dollars, so a promising career ahead.

June 27, 2014, 10:55

Ok it is so nice presented and try that

Leave a new comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "apple": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.

Advertisements