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.
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 link: hacker-top.tgz
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 'https://catonmat.net/ftp/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.
(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.
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.