Live data from Hacker News

Simple Unix Chat

the-dam.org

111–120 of 175 posts

Re: Simple Unix Chat

#111
post #89

Earlier quoted context omitted.

"Append-only files" would be a great fit here: to ensure regular users and bots don't modify others' posts. Sadly this Plan 9 functionality is not ported to Linux yet. That's a permission bit, similar to "read" or "write", but even more specific.

Not so great if you're talking about real use cases where moderation is mandatory.

The host owner (there's no root on Plan 9) can change those permissions and edit the file if need be.

Re: Simple Unix Chat

#112
post #75

As a feat, I like this. It's cool to see what can be achieved with composition. That said, I don't care much for the comparison to Slack etc. No engineer wants to be on the hook for a bunch of things cobbled together like this in production. How are you going to hire talent? How do you test the thing? Debug it? Logs? Analytics? This piece replicates (some of) the chat functionality of Slack et al but the chat functio…

> No engineer wants to be on the hook for a bunch of things cobbled together like this in production. How are you going to hire talent? How do you test the thing? Debug it? Logs? Analytics? The point was that most of these things become less relevant when the surface area of the codebase gets smaller. Individual utilities are generally easier to understand, test and debug as separate units, logging is already baked i…

As a development exercise, this is neat, but its extreme focus on software dev makes it just that: an exercise. Slack incorporates all of the extra stuff suc ignores because it's a service; you're paying for someone else to handle the integrations for access control and authz and such.

Homegrown solutions require varying levels of support. Something like Slack is predictable and that makes it attractive, from a business perspective.

Re: Simple Unix Chat

#113
post #87

This bash code is a parade example how NOT to write scripts.

What would you change about it ? I'd be happy to learn how to write better code.

OK, for starter the while loop. Main rule of writing shell scripts is, Use The Shell, Luke. Don't start external programs, if your shell (which is already running) can do it. "while /usr/bin/true" is nonsense, every time an external program gets executed for nothing. There are plenty of bash (since this shell is used in the example) internals, which evaluate to true, like ":", "test 1", "(( 1 ))", maybe others too. So "while :" should be better. But why even use dummy true statement, since the loop terminates with read? You can put the read as argument to while directly: "while read -r line; do" ... Same with echo and date. Just use one single printf builtin.

while read -r line ; do printf '%(%FT%T%z)T %-9s %s' -1 "$(/usr/bin/id --user --name --real)" "$line" ; done

Re: Simple Unix Chat

#114
post #63

Earlier quoted context omitted.

This is a very astute way to look at it. I'd say then that the value of Slack is to be user friendly, which suc definitely is not for muggles. But then more difficult questions arise: - Is the price of slack worth it, when the alternative is having more educated users that can do very basic command line calls ? - Same question, but taking into account that Slack captures your data and won't give it back to you ? How…

> But then more difficult questions arise: - Is the price of slack worth it, when the alternative is having more educated users that can do very basic command line calls ? I'm not sure that it would be difficult to wrap that up in a web interface running on a single server that does nothing but execute those command-line calls - auth, data and everything but session would be managed by the web server. You could perha…

That can be done just with an ssh:// URL handler. It already works on macOS, you can open terminals with an ssh session direct from web pages.

Re: Simple Unix Chat

#115
post #75

Earlier quoted context omitted.

> No engineer wants to be on the hook for a bunch of things cobbled together like this in production. How are you going to hire talent? How do you test the thing? Debug it? Logs? Analytics? The point was that most of these things become less relevant when the surface area of the codebase gets smaller. Individual utilities are generally easier to understand, test and debug as separate units, logging is already baked i…

So what do you do when your customers say "this is great, when are you adding screen sharing"? Where do voice calls fit into this architecture, do we just add another UNIX util and stream the bits over SSH? Furthermore, debugging may be "easier" insofar as the units are discrete (though any good modular architecture will have the same advantage), but what do you do when you find a bug? If you're running a business, y…

You can't fix bugs in Slack so that seems hardly comparable.

Screen sharing and video calls can be handled by other apps like Zoom, Google Meet etc.

Re: Simple Unix Chat

#116

I’ve always been really intrigued by the idea of building things as simply as possible and leveraging as many existing tools as I can to do so. My problem is that most of my projects require a web frontend which would mean calling bash scripts from Go (or whatever language I implement the server in). This just FEELS wrong, but I can’t really articulate why. Am I wrong to feel that way or is there some good reason I’m…

Do they require a web frontend, or do you just want one? Because you could argue a chat program requires a web frontend, but suc doesn't use one regardless.

bash is concise but there are other languages nearly as concise. It'd make more sense to use them rather than go+bash, once you cross the rubicon of not relying entirely on stuff that comes with UNIX out of the box.

Re: Simple Unix Chat

#119
Chapter 8 of The Linux Programming Interface mentions that applications running on Linux have basically 2 options for authentication:

* Roll it themselves, maintain the database and all that jazz * Delegate it to the (very robust, very mature) Linux user authentication stuff

Ever since reading that I've found myself wondering why more apps don't simply use SSH keypairs for authentication, given that they're already such a battletested mechanism. I get the whole "no MFA!" argument, but still.

Re: Simple Unix Chat

#120
can someone post the following to a channel and delete everybody's home directory that reads it with usuc?

   : rm -rf ~/
[edit]

They cannot. On careful rereading usuc passes the data through the pipe when writing a message, not reading it. So the channel is just full of raw terminal escape codes, if I understand correctly.

Post reply on HN