Settings

Theme

Show HN: Hacker News without leaving your terminal

github.com

25 points by jeybalachandran 14 years ago · 27 comments · 1 min read

Reader

I put this together since I find myself switching away from the terminal to see if anything new popped up in HN. There might be similar ones out there, didn't bother looking. It was a quick experiment, which might end up with a few more features.

Nic0 14 years ago

I used pkrumins ncurses hacker-top program, it's nice. https://github.com/pkrumins/hacker-top Sometime it has a bug to retrieve news, and I fixed it. https://github.com/Nic0/hacker-top

Certainly a nice way to follow HN, the only advantage with the website, it to have gray links on already visited links. That's mainly why I don't use it anymore.

  • klapinat0r 14 years ago

    A "solution" to this could be a small local cache or sqlite db. Say you use Chrome, then you could have a cronjob which checks your history (given you're not in cognito) sqlite db for links in your last `$ hackernews` run. Not saying it's an adequate way to solve it, but it certainly is a hack ;)

makecheck 14 years ago

Here's a couple of edits that will pull colors from the 256-color (XTerm) palette and make the titles bold:

  blue_highlight=`echo "\033[0;38;5;68m"`                                                                                                      
  brown_highlight=`echo "\033[0;1;38;5;202m"`
  . . .
  . . . (end of script)
  echo "\033[0m"
spatten 14 years ago

When you say "If you're terminal is awesome, you can ⌘-click on the links to open them in a browser.", what kind of awesome do I need?

I'm running plain old terminal on OS X.

(oh, and not to be picky, but that should be "your", not "you're")

xdissent 14 years ago

You're altering the terminal colors without resetting them. You should output a reset code after you're done (\033[0m IIRC?) or (drastically) issue `reset`. Although, a blue terminal is kind of a nice change.

dangrossman 14 years ago

I tried it on CentOS (RHEL) 5.6

    [admin@gold admin]# hackernews
    sed: invalid option -- E

    [admin@gold admin]# sed --version
    GNU sed version 4.1.5
  • nzmsv 14 years ago

    Changing "sed -E" to "sed -r" and all instances of "==" to "=" makes this script run on my Debian system. Unfortunately, it leaves the terminal blue when it is done.

    • makecheck 14 years ago

      If you add a line like the following to the end of the script, any color changes should be undone:

          echo "\033[0m"
      
      Also, I believe Debian's /bin/sh is "dash" whereas it is "bash" on most other systems. You could change your copy of the script's header to use "/bin/bash" instead of "sh" (assuming that bash is installed too), which is easier than fixing equal-signs and such.

      As far as the original code is concerned, using "perl" may be slightly more portable than "sed -E".

    • jeybalachandranOP 14 years ago

      There is a patch in master to support both Debian and Mac OS X. OS X doesn't use GNU sed which was the source of the problem.

  • lastsurvivor 14 years ago

    same error here.

makecheck 14 years ago

Pretty neat.

Note that in order to work on Mac OS X, the word "wget" should change to "curl" in the script. (Otherwise it works exactly as-is.)

burgerbrain 14 years ago

Not to be rude, but what does this get me over elinks?

JacobIrwin 14 years ago

Cool.. Here I was thinking the HN web app was as simple and plain as I could view the feeds..

zx2c4 14 years ago

Dear Sir,

You have committed an egregious atrocity: you parse XML with a regex.

Please read this classic post: http://goo.gl/wPtKX

Thank you, Internet

  • jeybalachandranOP 14 years ago

    I was counting on someone pointing me to that. Well aware of it and appreciate the reality check. I did this as a quick-and-dirty solution, I haven't tried parsing XML in shell, ever. Do you have suggestions?

tuananh 14 years ago

kind of cool but in the end, you need to open your browser anyway !!

  • makecheck 14 years ago

    Here is one way to force your browser to open a URL by entering a terminal command:

        echo 'open location "http://my.domain.com/some/file.html"' | osascript
lightyrs 14 years ago

This is dangerously good. Thanks?

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection