4 ms·
Show HN: Hacker News without leaving your terminal
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.
- makecheck 15y agoPretty 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.)
- jeybalachandran 15y agoGreat catch, I have wget installed via brew so overlooked that, I'll create a patch shortly.
- spatten 15y agoWhen 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")
- brandur 15y agoiTerm2 for OS X will do this: http://www.iterm2.com/#/section/home http://www.iterm2.com/#/section/home
- Groxx 15y agoThey probably mean iTerm2 (which is a definite upgrade, worth it if you haven't tried it)
- xdissent 15y agoPlain old terminal works for me, but you have to ⌘-double-click.
- kip_ 15y agoI'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.
- makecheck 15y agoMacTerm does this, for one. http://www.macterm.net/ http://www.macterm.net/
- dangrossman 15y agoI 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
- lastsurvivor 15y agosame error here.
- nzmsv 15y agoChanging "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 15y agoIf 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".
- jeybalachandran 15y agoThere 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.
- tuananh 15y agokind of cool but in the end, you need to open your browser anyway !!
- burgerbrain 15y agoNot to be rude, but what does this get me over elinks?
- xdissent 15y agoYou'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.
- jeybalachandran 15y agoFixed, thanks!
- Nic0 15y agoI used pkrumins ncurses hacker-top program, it's nice. https://github.com/pkrumins/hacker-top https://github.com/pkrumins/hacker-top Sometime it has a bug to retrieve news, and I fixed it. https://github.com/Nic0/hacker-top 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 15y agoA "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 15y agoHere'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"
- jeybalachandran 15y agoThanks, fixed in master. Also updated so only uses colors via a -c argument.
- lightyrs 15y agoThis is dangerously good. Thanks?
- JacobIrwin 15y agoCool.. Here I was thinking the HN web app was as simple and plain as I could view the feeds..
- zx2c4 15y agoDear Sir, You have committed an egregious atrocity: you parse XML with a regex. Please read this classic post: http://goo.gl/wPtKX http://goo.gl/wPtKX Thank you, Internet
- jeybalachandran 15y agoI 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?