Show HN: Hacker News without leaving your terminal
github.comI 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. 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. 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 ;) Here's a couple of edits that will pull colors from the 256-color (XTerm) palette and make the titles bold: Thanks, fixed in master. Also updated so only uses colors via a -c argument. 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") 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. MacTerm does this, for one. They probably mean iTerm2 (which is a definite upgrade, worth it if you haven't tried it) Plain old terminal works for me, but you have to ⌘-double-click. iTerm2 for OS X will do this: http://www.iterm2.com/#/section/home 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. Fixed, thanks! I tried it on CentOS (RHEL) 5.6 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. If you add a line like the following to the end of the script, any color changes should be undone: As far as the original code is concerned, using "perl" may be slightly more portable than "sed -E". 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. same error here. 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.) Great catch, I have wget installed via brew so overlooked that, I'll create a patch shortly. Not to be rude, but what does this get me over elinks? Cool.. Here I was thinking the HN web app was as simple and plain as I could view the feeds.. 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 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? kind of cool but in the end, you need to open your browser anyway !! Here is one way to force your browser to open a URL by entering a terminal command: You can also open an url with: This is dangerously good. Thanks?
blue_highlight=`echo "\033[0;38;5;68m"`
brown_highlight=`echo "\033[0;1;38;5;202m"`
. . .
. . . (end of script)
echo "\033[0m"
[admin@gold admin]# hackernews
sed: invalid option -- E
[admin@gold admin]# sed --version
GNU sed version 4.1.5
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. echo "\033[0m"
echo 'open location "http://my.domain.com/some/file.html"' | osascript
open http://my.domain.com/some/file.html