News for hackers. Stuff that matters.
Re:Show HN: Hacker News without leaving your terminal by Nic0 on Monday December 26, 2011 @03:58AM (#3392578)
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.

Re:Show HN: Hacker News without leaving your terminal by klapinat0r on Monday December 26, 2011 @04:30AM (#3392613)
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 ;)
Re:Show HN: Hacker News without leaving your terminal by makecheck on Monday December 26, 2011 @03:59AM (#3392580)
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"
Re:Show HN: Hacker News without leaving your terminal by jeybalachandran on Monday December 26, 2011 @10:06AM (#3393037)
Thanks, fixed in master. Also updated so only uses colors via a -c argument.
Re:Show HN: Hacker News without leaving your terminal by spatten on Monday December 26, 2011 @03:04AM (#3392493)
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")

Re:Show HN: Hacker News without leaving your terminal by kip_ on Monday December 26, 2011 @03:35AM (#3392538)
I'm running plain old terminal on OS X Lion and if I hold down the ⌘-key and double click, the link in the terminal opens in my default browser.
Re:Show HN: Hacker News without leaving your terminal by makecheck on Monday December 26, 2011 @03:37AM (#3392543)
MacTerm does this, for one.

http://www.macterm.net/

Re:Show HN: Hacker News without leaving your terminal by Groxx on Monday December 26, 2011 @03:21AM (#3392521)
They probably mean iTerm2 (which is a definite upgrade, worth it if you haven't tried it)
Re:Show HN: Hacker News without leaving your terminal by xdissent on Monday December 26, 2011 @03:27AM (#3392530)
Plain old terminal works for me, but you have to ⌘-double-click.
Re:Show HN: Hacker News without leaving your terminal by brandur on Monday December 26, 2011 @03:20AM (#3392520)
iTerm2 for OS X will do this: http://www.iterm2.com/#/section/home
Re:Show HN: Hacker News without leaving your terminal by xdissent on Monday December 26, 2011 @03:44AM (#3392552)
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.
Re:Show HN: Hacker News without leaving your terminal by jeybalachandran on Monday December 26, 2011 @01:58PM (#3393609)
Fixed, thanks!
Re:Show HN: Hacker News without leaving your terminal by dangrossman on Monday December 26, 2011 @03:08AM (#3392502)
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
Re:Show HN: Hacker News without leaving your terminal by nzmsv on Monday December 26, 2011 @03:32AM (#3392536)
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.
Re:Show HN: Hacker News without leaving your terminal by makecheck on Monday December 26, 2011 @03:43AM (#3392551)
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".

Re:Show HN: Hacker News without leaving your terminal by jeybalachandran on Monday December 26, 2011 @10:28AM (#3393068)
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.
Re:Show HN: Hacker News without leaving your terminal by lastsurvivor on Monday December 26, 2011 @03:29AM (#3392533)
same error here.
Re:Show HN: Hacker News without leaving your terminal by makecheck on Monday December 26, 2011 @02:20AM (#3392449)
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.)

Re:Show HN: Hacker News without leaving your terminal by jeybalachandran on Monday December 26, 2011 @02:22AM (#3392452)
Great catch, I have wget installed via brew so overlooked that, I'll create a patch shortly.
Re:Show HN: Hacker News without leaving your terminal by burgerbrain on Monday December 26, 2011 @03:40AM (#3392549)
Not to be rude, but what does this get me over elinks?
Re:Show HN: Hacker News without leaving your terminal by JacobIrwin on Monday December 26, 2011 @04:48AM (#3392631)
Cool.. Here I was thinking the HN web app was as simple and plain as I could view the feeds..
Re:Show HN: Hacker News without leaving your terminal by zx2c4 on Monday December 26, 2011 @06:20AM (#3392729)
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

Re:Show HN: Hacker News without leaving your terminal by jeybalachandran on Monday December 26, 2011 @08:50AM (#3392881)
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?
Re:Show HN: Hacker News without leaving your terminal by tuananh on Monday December 26, 2011 @03:25AM (#3392526)
kind of cool but in the end, you need to open your browser anyway !!
Re:Show HN: Hacker News without leaving your terminal by makecheck on Monday December 26, 2011 @03:31AM (#3392535)
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
Re:Show HN: Hacker News without leaving your terminal by fceccon on Monday December 26, 2011 @05:59AM (#3392714)
You can also open an url with:

   open http://my.domain.com/some/file.html
Re:Show HN: Hacker News without leaving your terminal by lightyrs on Monday December 26, 2011 @04:16AM (#3392597)
This is dangerously good. Thanks?