one of my favorite things about star trek is how people will routinely be in some first contact situation and get a computer built by some civilization they know literally nothing about to do stuff for them, whereas i, a 21st century computer professional, am basically incapacitated if i sit down at a computer running the same operating system i use but configured slightly differently or try to use a telephone manufactured by a different company than the one i'm used to.

@brennen counterpoint: Scotty did try to talk to that mouse

@earthtopus a fair counterpoint, but it is kind of a setup for the bit where scotty then does some sort of CAD wizard shit and lays out a major advance in materials science from memory on the spot

@earthtopus i tried to use the editor from DOS the other day and my brain basically locked up on not being able to undo stuff

@brennen you'd do better too if you had access to a "universal translator" or if your understanding a computer console was necessary to advance a plot

@brennen an unrelated question: say I have a big text file and I want to find the line(s) with the most instances of a substring on it. Say the most instances of the letter R.

What's a good (and by good I mean lazy) way to do that?

@earthtopus ok, so i'm too fried right now for man pages and stackoverflow searches, but this is what i wound up adding to my personal utility collection in case i want to do this again:

code.p1k3.com/gitea/brennen/bp

you could save that and run it like:

perl ./matches-per-line "R" file.txt | sort -n | tail -1

and it should give you the line with the most R. leave off the tail in case there might be lines with the same number of occurrences of the substring.

· · Web · 1 · 0 · 0

@earthtopus it's a properly lazy script because it doesn't bother trying to be smart about what's the most of anything, you can just outsource that to "sort -n" if you need it, it doesn't have to worry about keeping track of a max value, and this way you could use it for plotting frequencies or whatever.

@brennen thanks, I'll fuck around with it at some point soon hopefully

@brennen I'm using match-substrings which does almost precisely what I want but gives me a yak to shave, thank you for providing a yak customization service for me and I hope things are way less dire in your parts than might be feared!

@earthtopus bespoke-yaks-r-us, at your service.

and thanks - things are in decent shape right now, just hoping they stay that way.

Sign in to participate in the conversation
Mastodon

The original server operated by the Mastodon gGmbH non-profit