Live data from Hacker News

Simple Unix Chat

the-dam.org

131–140 of 175 posts

Re: Simple Unix Chat

#131
post #89

In case you're passing over this because it sounds like click bait (it KIND OF is), this was actually a good read to me. It goes over a utility called "suc" (Simple Unix Chat) that implements server functionalities from Slack, Discord, etc. using a very small codebase. The novel part is it leverages existing unix tools and methodology instead of re-inventing them. - Auth is handled by SSH. - Channels are just a file…

"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.

IIRC, Linux' ext2/3/4 support an 'a' attribute that make a file append-only.

Re: Simple Unix Chat

#132

Earlier quoted context omitted.

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.

I'm not talking about self-hosting suc, I'm arguing that all those extra lines of code in Mattermost (and presumably Slack) aren't doing nothing—a lot of them are a necessity if you're selling a software product.

Re: Simple Unix Chat

#133
post #125

In general, composing Unix commands is a very powerful means to construct complex applications... poorly, with no real pathways to fixing their shortcomings. I believe the traditional "Unix Way" is to gloss over said shortcomings and pretend they don't exist, and when that fails, move the goalposts and argue that they don't exist "in the real world". For example, what combination of shell commands can I use to output…

|For example, what combination of shell commands can I use to output the number of files in a directory? Hint: it probably isn't what you think it is, if it's even possible. `find . -type f | wc -l`

Good first attempt. But: counts two links to the same file twice. That is:

touch foo; ln foo bar

Is this one file or two "links" to the same file? ;-0

Re: Simple Unix Chat

#134
post #125

In general, composing Unix commands is a very powerful means to construct complex applications... poorly, with no real pathways to fixing their shortcomings. I believe the traditional "Unix Way" is to gloss over said shortcomings and pretend they don't exist, and when that fails, move the goalposts and argue that they don't exist "in the real world". For example, what combination of shell commands can I use to output…

It isn't what I think it is?

Oh.

Then it must be:

    command ls -F directory | grep -v '[/@]$' | nl | tail -n 1 | cut -f 1
(-:

Re: Simple Unix Chat

#135
post #125

In general, composing Unix commands is a very powerful means to construct complex applications... poorly, with no real pathways to fixing their shortcomings. I believe the traditional "Unix Way" is to gloss over said shortcomings and pretend they don't exist, and when that fails, move the goalposts and argue that they don't exist "in the real world". For example, what combination of shell commands can I use to output…

   find . -type f -depth 1 -print0 | tr -d -c '\000' | wc -c
GNU find has a -printf which would probably avoid the need to use tr. Personally, two hardlinks to the same underlying storage counts as two files to me, but I understand why you might disagree. I'd bet there's something out there that could give you only the count of unique storage areas, but I don't know how that interacts with deduplicating filesystems.

Re: Simple Unix Chat

#137
post #133

Earlier quoted context omitted.

|For example, what combination of shell commands can I use to output the number of files in a directory? Hint: it probably isn't what you think it is, if it's even possible. `find . -type f | wc -l`

Good first attempt. But: counts two links to the same file twice. That is: touch foo; ln foo bar Is this one file or two "links" to the same file? ;-0

You said files, not inodes. Those are two files sharing one inode. If you want to count inodes, specify that in the question.

Re: Simple Unix Chat

#138
post #133

Earlier quoted context omitted.

Good first attempt. But: counts two links to the same file twice. That is: touch foo; ln foo bar Is this one file or two "links" to the same file? ;-0

You said files, not inodes. Those are two files sharing one inode. If you want to count inodes, specify that in the question.

I'm not the one who posed the question. And: file, filename, inode, ...? What's what and what's exactly to be counted?

Re: Simple Unix Chat

#139
This is an incredibly cool Showcase of the power of Unix command line utilities and their composability. However, I have to say, as someone who recently got into amateur system administration for a server that hosts several services I and my friends use m, I would not want to be responsible for maintaining this!

Re: Simple Unix Chat

#140

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 s…

[deleted]
Post reply on HN