
Show HN: Hnwatch – Linux x64 terminal-based real-time HN watcher/reader - 2ton_jeff
https://2ton.com.au/hnwatch/
======
akavel
Hmmm! some nice stuff there besides the "hnwatch" itself:

\- it's apparently written in "FASM" assembler, which is BSD-licensed
(according to Wikipedia), cross-platform, self-hosting (?), Intel-syntax (my
preferred camp), and also has an experimental "g" version supporting output
targetting JVM, AVR & other fancy stuff (customizable via
"macroinstructions"):
[http://www.flatassembler.net/download.php](http://www.flatassembler.net/download.php)

\- IIUC, this "hnwatch" page is at the same time kinda delicate & non-pushy
advertisement for the author's (authors'?) multipurpose ASM library named
"HeavyThing" (i.e. kinda custom "stdlib"):
[https://2ton.com.au/HeavyThing/](https://2ton.com.au/HeavyThing/) (which
seems to be required to build "hnwatch"? It wasn't clear to me initially) -
worth some more highlight, I believe.

As a sideways wishful-thinking comment regarding the highlighter used for
showcasing the hnwatch sources: I'd much prefer if syntax was not highlighted
(i.e. the eye-piercing blue '[' & ']'), but instead the "call" instructions
would, as well as "jmp" and variants (with a different colour), user symbols
(different colour again) including especially labels (another colour please).
Also, if there were somewhat more comments in the sources. Also, in
[https://2ton.com.au/library_as_html/hnwatch/textify.inc.html](https://2ton.com.au/library_as_html/hnwatch/textify.inc.html),
the highlighter seems to have gone awry.

 _update:_ edited heavily to hopefully better express my positive attitude; in
the Interwebs, no one can see you smile

~~~
2ton_jeff
Nice to meet you, too.

Curious as to what your intention is by pointing out my investment in years of
profit-free GPLv3 development, and that somehow that is tied to the BSD
license of the compiler's creator.

Care to elaborate on a better method? I miss Turbo Assembler, which is in part
what brought fasm into existence.

"Advertisement" for GPLv3 sources?

I am not ashamed to openly admit my company would love more contract work,
consider what I have contributed for free the "world's most expensive
curriculum vitae". I'm interested to hear what other open source decision
makers have to say about this, but 2 Ton Digital as a Software resource has
made me bupkiss.

More the point, when someone wants something that requires a higher-than-
average level of skill, we get business. The community as a whole gets to
benefit because I keep turning it loose with no strings attached. Isn't that
the way it is supposed to work?

~~~
akavel
Hmh; I think there might have been kinda misunderstanding (?) - I'll edit my
comment to change "interesting" to "nice", hopefully this way it will better
express my original intent.

In other words, big thanks for making me aware of the FASM! Not sure if I'll
ever use it, but totally worth remembering for future, just in case. Or, who
knows; maybe for some hobby AVRing I hope to do it'd be actually easier than
the whole AVR-GCC stuff?

~~~
oneeyedpigeon
Your use of the word "apart" right at the beginning is likely to be a cause of
confusion. Clearly, in this context, you mean it in the "as well as" sense,
but I initially read it in the "instead of" sense, and I think most other
English-as-1st-language speakers would do the same. Qualifying it e.g. "quite
apart from..." can avoid the misunderstanding.

~~~
akavel
oh... ok; thanks! changed that too; hopefully better now? :/

------
agonzalezro
I made a docker image for this: [https://github.com/agonzalezro/docker-
hnwatch](https://github.com/agonzalezro/docker-hnwatch)

If you want to run it: docker run -it agonzalezro/hnwatch

I don't know why but hnwatch doesn't look like working ATM. I've tried in a
Linux box (without docker) and I have the same problem with the tty, it's just
loading 4 news and no comments or similar.

~~~
jonathonf
Dude, use alpine (~5MB) rather than ubuntu (~190MB) for the base image!

~~~
agonzalezro
Done. Awesome image! Thanks for sharing :)

------
2ton_jeff
outside curios request related to this submission, I have always configured
webservers to return "400 Bad Requests" on HTTP/1.1 requests that lack a Host:
header.

Still, every interaction I have had with HN this year always results in lots
of hosts getting said results, and while this one is going, the most offensive
host: 207.226.141.203 (dns: 207-226-141-203.static.pccwglobal.net) .. 1800
requests and counting from that host... ??

------
andy_ppp
Hmmm. I wonder if someone can write a hacker news comment that'll cause remote
code execution on those running this...[1] I would have no idea how easy
protecting buffer overflows is in assembly but I'm guessing it's harder than
C.

[1] consider this a challenge...

~~~
2ton_jeff
You obviously didn't scrutinize my code :-)

~~~
andy_ppp
Ah yes! After reading through the code it's become _crystal_ clear to me that
your code is bullet proof :-)

------
dimitar
Why choose assembly for this?

~~~
2ton_jeff
Ha! Great question, one that I get asked semi-frequently. 1) Because unlike
many, I can, 2) Because contrary to popular belief, it is not difficult. :)

~~~
2ton_jeff
my main desktop is also Mac OS X, I run vmware fusion + linux hosts when
necessary, but all of my server infrastructure is linux anyway :-) linux
kernel makes assembler so much easier than OS X and of course all of my
library is catered for server-side infrastructure.

~~~
oneeyedpigeon
Yeah, my only easy option is to run this on our live web server. Hmmm,
conflicted ...

~~~
2ton_jeff
again FWIW, I am the co-founder of a proper Australian registered business, I
appreciate your concern. In an isolated environment, run it with strace -o
nasties.txt or something similar. I assure you personally that the only
outbound connects this thing does is to your locally defined DNS and
firebaseio per the HN API, and is not terribly unpleasant to any host CPU
(near as I can tell anyway, and that was before I enabled the 150 item limit
on the main page indices).

------
Tiksi
This is awesome, the sshtalk mentioned above looks great too, although trying
to brute force a room name isn't working out for me.

I found a few of the key bindings by accident, trying to scroll with j. I
considered making something like this a long while ago, but definitely not in
asm, this is impressive.

I may have to poke at the code a bit and see if I can add/change a couple
things :)

~~~
2ton_jeff
FWIW, I intentionally didn't implement a "/list" feature for it, as it was
originally designed to be an in-house sorta ephemeral chat thing... not many
requests for a public "IRC-style" ssh chat server, if there is by all means
adding the feature for a "/list" wouldn't take long

~~~
Tiksi
I was just poking around to see how it works. I love the idea, but I doubt I
could convince enough people to join that wouldn't already have the room name
to justify the effort of adding a /list.

------
Karlozkiller
I really don't get this to work as I feel it should. Initially I get like 4
articles showing up, sometimes two articles have the same pos-value.

The list of articles then continues to be populated very slowly (I'm up to 12
now after a minute or so maybe?).

I've tried it on two different networks, one of them being 100/100mbit/s
fiberoptics.

Am I missing something?

~~~
2ton_jeff
WYSIWYG sadly, hnwatch grabs the ID list to fetch from the SSE direct from
firebaseio (and thus the public API). It was working a treat (and accurately
reproducing everything from HN web-proper) prior to my releasing this... IDK
what the proper course of action is from here... :-/

------
daveloyall
The HTML rendering of the source code at
[https://2ton.com.au/library_as_html/hnwatch/textify.inc.html](https://2ton.com.au/library_as_html/hnwatch/textify.inc.html)
is broken due to the inclusion of markup delimiter type characters in the
source.

------
dimitar
I love your ssh "site" \- ssh 2ton.com.au I like the idea of using the talk
command

~~~
2ton_jeff
Yeah I spent a very interesting day chatting to heaps of people, haha, wasn't
even logged in until just then :) glad it is appreciated. I can't handle too
many chats all-at-once, but am logged into it now :) Edit: meant to include
the origin of my day's sshtalk fun:
[https://news.ycombinator.com/item?id=9716459](https://news.ycombinator.com/item?id=9716459)

~~~
pantalaimon
Is there a list of active rooms somewhere?

~~~
2ton_jeff
See prior comment about the intentional omission of "/list" functionality

~~~
pantalaimon
Well I'd also take just _one_ active room ;)

~~~
simcop2387
I'm gonna idle in 'chat' and see what happens.

------
Torgo
Pretty cool.

I do however get a coredump resizing the terminal window: Ubuntu 14.04LTS,
tmux, hnwatch

------
jpstory
Awesome work! Unfortunately I too am only seeing the first 4 lines of HN.
Also, when I press Enter on a selection, it doesn't show comments. I love the
idea of this and I hope to see its development continue!

------
rttlesnke
I'm getting this on scrolling:

[http://i.imgur.com/UnTepmd.png](http://i.imgur.com/UnTepmd.png)

------
harel
If you listen closely, you can hear me clapping. Well done.

------
UserRights
is anybody using their rwasa webserver in production?

~~~
jonathonf
I've just migrated a set of Docker containers on one host from jessie+nginx to
alpine+rwasa.

Looking good so far.

------
jonathonf
Feature request: page up and down keys.

:)

------
fascinated
lynx

~~~
jrcii
You could /almost/ have this with newsbeauter and lynx, except that the RSS
feed doesn't include points or comment number and lynx doesn't indent
comments, so all comments appear at the same thread level which is somewhat
confusing.

~~~
profsnuggles
I use this in my elinks hooks.pl to indent hn comments.

    
    
        use strict;
        use warnings;
        
        use Encode;
        use Mojo::DOM;
    
        sub pre_format_html_hook {
            my $url = shift;
            my $html = Mojo::DOM->new(decode_utf8(shift));
        
            if ($url =~ 'news\.ycombinator\.com') {
                $html->find('img[src="s.gif"]')->each(sub { my $e = shift;
                                                            my $w = $e->attr('width');
                                                            my $ns = '&nbsp;' x ( $w / 10 );
                                                            $e->replace($ns); });
        }
    
        return $html;
    }

