Live data from Hacker News

Simple Unix Chat

the-dam.org

141–150 of 175 posts

Re: Simple Unix Chat

#141
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…

[deleted]

Re: Simple Unix Chat

#142
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…

Mastering UNIX allows you to pull tools out of a toolbelt and adapt to the situations as the arise. No one tool should solve every job. You can happily ignore problems that aren’t relevant to the issue at hand. Two servers need to talk to each other behind a strong firewall in a private network, sure, skip complex authentication setups. Knowing how to build in layers is good engineering practice.

Whereas large scale enterprise commercial solutions make money by selling you on complete solutions that force you to relearn everything their way from the ground up. Just look at how AWS has hijacked so many concepts from the modern web and trapped people into building “cloud-agnostic” wrappers to try and wrangle the mess. Still we’re mapping onto their redesigns of the same old stuff.

At some level it’s unavoidable, hardware vendors need to agree on instructions after all, but when looking at the situation from a high level, it’s best to keep our ideals in mind and steer the ship so-as to find ourselves in paradise not lost in a sea of pirates.

One ideal: Modularity. Promotes healthy competition. Another ideal: Simplicity is more easily achieved when modular components may be used (and tested) in isolation.

Re: Simple Unix Chat

#143

Earlier quoted context omitted.

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.

Sure, there is a lot of code that is doing something, but is it doing the right thing correctly and efficiently? It's likely that a > 500k sloc project is filled with low quality and inefficient code. I'm pretty sure this is a natural law. The only way to limit this is by placing quality and efficiency among the highest virtues, which is essentially anti-capitalist.

Re: Simple Unix Chat

#144
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.

[deleted]

Re: Simple Unix Chat

#145
post #7

Earlier quoted context omitted.

I had a similar thought. But it also struck me that "externalising the maximalism" by using a library like the unix ssh implementation is probably the best way to go about it, since it's a widely used well tested library that implements a complex use case. In scientific programming I'd say that's the same as using a library like GSL, BLAS or even numpy. The net impact on LoC in my project is minimal, even though it c…

> But it also struck me that "externalising the maximalism" by using a library like the unix ssh implementation Not saying this to be argumentative, only to emphasize the same conflicting dynamic I saw in the post: this is exactly the same rationale that people routinely lambast here about NPM and other sources of dependencies. It’s libraries and frameworks all the way down. I’m cool with that, I’m just not cool with…

i think one important difference between externalizing complexity to unix tools like ssh, and externalizing complexity to npm libraries, is related to (for lack of a better term) quality control

any dingbat with a terminal can produce an npm library that you can use in your application, the level of quality control is basically zero

but it takes a pretty strong track record to get your software into coreutils, or really any base linux distribution

to put it kind of cynically, i think there is an enormous difference between relying on ssh vs. relying on leftpad, gatekeeping based on competence measured over time is i think actually important and good to do

Re: Simple Unix Chat

#146
post #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.

Nice! This wins :)

I had to modify it a bit to get it to work cross-platform, but the approach does appear to be sound:

    find . -maxdepth 1 -type f -print0 | tr -d -c '\000' | wc -c
I had originally written "Hint: it probably isn't what you think it is, if it's even possible", but after testing for a bit, I updated my comment in what was apparently a fit of hubris to say you couldn't.

Re: Simple Unix Chat

#147
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`

This doesn't work. Try setting up a test directory as follows:

    touch first$'\n'file
    touch .hidden$'\n'file
    mkdir folder$'\n'.
    touch folder$'\n'./another$'\n'file
There are two files in the folder, or three if you want to count files in subdirectories too.

Your solution incorrectly outputs 7.

Re: Simple Unix Chat

#148
post #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 (-:

This doesn't work. Try setting up a folder as follows:

    touch first$'\n'file
    touch .hidden$'\n'file
    mkdir folder$'\n'.
    touch folder$'\n'./another$'\n'file
    mkdir normal
    touch normal/whatever
This folder has two files in it, or four if you count files in subdirectories.

Your solution incorrectly outputs 3.

Re: Simple Unix Chat

#149

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!

Yeah in the tests I ran while designing it, it became apparent that keeping everything in order was kind of a pain. However, with Guix it actually becomes quite easy. There is not "state" in the system: the system is simply a function of your system declaration (the /etc/config.scm file) that defines the whole OS. No need to remember what to chmod chown, etc.

Re: Simple Unix Chat

#150
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

absent further qualifications it is two files
Post reply on HN