File this under #shell #functions I should have written years ago:

function grepc { #Do a grep -c, but skipping files with no results grep -c "$@" |grep -v ':0$' }

#unix #UnixShell #ShellScripting #bash #ksh

@rl_dane

Oh, didn't know about -c. I usually just pipe to wc -l I guess.

@amin

-c, -l, -h, -H, and -q are my favorite #grep flags. :D

Huh, that almost became a [Marcel Duchamp] reference. 😅

Marcel Duchamp - Wikipedia

@rl_dane

I just use -v and -E

@amin @rl_dane you guys use flags?... :p
@amin @rl_dane @sotolf You guys still use grep instead of ripgrep. Tst

@thedoctor @amin @sotolf

...and bash instead of zsh
...and grep/awk/sed instead of jq
...and firefox instead of chrome
...and the fediverse instead of facebook

Face it... I'm an unpopular-opinion neckbeard level boss. XD

cc: @mirabilos

@rl_dane Those are so not comparable!

@amin @sotolf @mirabilos

@thedoctor @rl_dane @amin @mirabilos At least bash and zsh is comparable to grep ripgrep, as zsh is just a strictly better bash ;)

@sotolf @thedoctor @rl_dane @mirabilos

Mm, not really though? ripgrep is meant for bulk grepping of files

@amin @thedoctor @rl_dane @mirabilos I think I had it installed, I just never remembered to use it :p

@sotolf @thedoctor @rl_dane @mirabilos

I mostly just use it to run rg TODO and see all the spots in a codebase I marked as still needing work.

@amin @sotolf @thedoctor @mirabilos

Why is ripgrep better than just grep -R?

@rl_dane @amin @sotolf @thedoctor @mirabilos it's somehow a lot faster if you want to grep a few GiB of code, like 15 minutes to 30 seconds

@kabel42 @amin @sotolf @thedoctor @mirabilos

Interesting! I wonder what kind of algorithmic optimizations (as opposed to compiler optimizations) they're using to do that, and if regular (GNU/BSD) grep could do the same.

Because I'll wear clown shoes and a tutu before changing to a "rewrite the world in rust!" utility 😂

@rl_dane @amin @sotolf @thedoctor @mirabilos From what little i have read, some assumptions about what you are greping and different defaults. Doing the same in existing grep would probably break compatibility.
@kabel42 @rl_dane @amin @thedoctor @mirabilos Ah, so it's basically cheating, I mean, it does work, and I do it often when I create small tools, with the excuse that "It wasn't meant for that"
@sotolf @rl_dane @amin @thedoctor @mirabilos Is it cheating, if it is the second sentence in you README.md?
"ripgrep will respect gitignore rules and automatically skip hidden files/directories and binary files. (To disable all automatic filtering by default, use rg -uuu.)"
or, you didn't want to grep in .git anyway you are just too lazy to look up the flag to skip that
@kabel42 @rl_dane @amin @thedoctor @mirabilos All optimisation are just different ways of cheating ;)
@sotolf @rl_dane @amin @thedoctor @mirabilos doesn't cheating imply that you are dishonest about it?
@kabel42 @rl_dane @amin @thedoctor @mirabilos I don't know, it might be just that my mother-tongue's word for it "jukse" also has a connotation of taking the easy way out or a shortcut instead of doing the whole thing. And I transferred that over to english.

@kabel42 @thedoctor @rl_dane @sotolf @amin ah, I think English distinguishes between "taking a shortcut" (sanctioned or not), a middle thing I get to below, and (dishonest) cheating.

The middle thing: for some reasons, they have this "time-honoured tradition of cheating" (e.g. in the Triwizard Tournament) which they sometimes see as heroic or at least obvious in the sense that everyone does it and nobody talks about it.

@sotolf @rl_dane @amin @thedoctor @mirabilos could be the same for German, where you have the choice of "Schummeln" and "Betrügen" :)

@kabel42 @rl_dane @amin @thedoctor @mirabilos Yeah, cheating as in Schummeln, not as in Betrügen.

I also saw now when looking the word up that it comes from german "juxen" which is "playing around, having fun" which is kind of a fun way that the word has been wandering :)

@sotolf @rl_dane @kabel42 @thedoctor @amin cheating can be Schummeln but I think it is usually somewhat more down the scale towards Betrügen, unless explicit in e.g. game
night context
@mirabilos @sotolf @rl_dane @thedoctor @amin
If using assumptions for optimization is cheating, is using Newtonian physics cheating?
@kabel42 @mirabilos @rl_dane @thedoctor @amin I mean, I cheat going to work each day, since I'm taking some shortcuts along the way :)

@sotolf @kabel42 @rl_dane @thedoctor @amin there’s meanings of to take a shortcut that aren’t related to cheating ;)

Consider a Venn diagram between both; they merely overlap, not subset.

@sotolf @kabel42 @rl_dane @thedoctor @amin … must … not … be … nerdsniped … to … make … Venn … diagram … between … terms … of … three … different … languages …

@mirabilos @sotolf @kabel42 @thedoctor @amin

lol do give in, I'd love to see how you create it. xfig? teX? ASCII art?

@rl_dane @mirabilos @sotolf @thedoctor @amin corel draw for windows 3.1 :)
@kabel42 @rl_dane @sotolf @thedoctor @amin do I look like I could afford that?
CorelDRAW! 3 : Corel Corporation : Free Download, Borrow, and Streaming : Internet Archive

CorelDRAW! is the PC graphics software package for everyone!Inside you'll find:CorelDRAW 3.0, the latest version of our award-winning illustration package, now...

Internet Archive
Corel CorelDraw 3.0 : Corel : Free Download, Borrow, and Streaming : Internet Archive

Corel CorelDraw 3.0 ( 3.0b) ( 1992 10) [ English] ( CD)Includes:CorelDRAW 3.0CorelCHART 3.0Corel PHOTO-PAINT 3.0CorelSHOW 3.0CorelTRACE 3.0CorelMOSAIC 3.0

Internet Archive
@rl_dane @sotolf @kabel42 @thedoctor @amin … probably Inkscape while constantly cursing.

@mirabilos @sotolf @kabel42 @thedoctor @amin

Sounds like me using GIMP 3.

Horrrrrid UI changes in GTK3. Horrid. Horrid.

@rl_dane @sotolf @kabel42 @thedoctor @amin that too, but Inkscape is just… Inkscape.

If I were a little better at SVG, I’d possibly use Inkscape’s XML window to write SVG as XML directly and just see it auto-updating the graphical representation, like some Tₑχ/LᴬTᴇΧ editors can.

@mirabilos @kabel42 @rl_dane @thedoctor @amin

Yeah, I mean if I would actually take this seriously for a moment, yeah cheating really depends on the goal, my goal for going to work is not excercise, so technically taking a shortcut is more about efficiency rather than doing something that lessens the thing, if I however did the walk to have excercise it would be, even though the physical action done was exactly the same, the only way to differenciate is the goal.

@mirabilos @sotolf @rl_dane @thedoctor @amin but both are, using assumptions to use a simpler model, right?

@kabel42 @mirabilos @rl_dane @thedoctor @amin

There are also different assumptions, I sped up an import job today, that dealt with barcodes, they get printed in batches, and I sped the runtime up from 2 hours + to 30 sek by checking the first item in each batch before splitting them up and having to deal with 40 000 + items, it's cheating / optimisation since I check only if the first one in the batch got imported, but because they do the writing within a transaction, if the first one of the batch is imported the rest are as well.

@kabel42 @sotolf @rl_dane @thedoctor @amin it’s more like: if you translate, you have to consider meaning. If you, for example, take the word Quelle (in the meaning of “origin of citation” and translate it to Dutch, you get “bron”. If you translate “bron” back to German, you get Brunnen. This does not mean you could substitute the word Brunnen in the original German text, despite Brunnen and Quelle (in the sense of where water comes from the ground) are the same thing, even in German.
@mirabilos @kabel42 @rl_dane @thedoctor @amin And this is one of the reasons why machine translation is as garbage as it is, it can't keep the context well enough, and find recipe sites with recipies for "Informationskapslen" statt Kekse..
@sotolf @kabel42 @rl_dane @thedoctor @amin „kein Weltraum links auf dem Gerät“. „Pfeife zerbrochen.“
@sotolf @kabel42 @rl_dane @thedoctor @amin (and this is why I run my computers including Smartphone on English, or rather, the original language if I know it)
@mirabilos @kabel42 @rl_dane @thedoctor @amin Yeah, sadly with how the world is now, normally the english translation, if there is one is way better than any other ones, which they do with machine translation or something else, even worse with small languages, some times they just decide that norwegian and danish is basically the same, so we just relabel the translation and that's good enough, or you end up with something that must have been translated with a dictionairy and having never used the language before like this:
@sotolf @mirabilos @rl_dane @thedoctor @amin a good translation would be different for english and american

@kabel42 @mirabilos @rl_dane @thedoctor @amin

English (Traditional)
English (Simplified)

@sotolf @mirabilos @rl_dane @thedoctor @amin yes :)
although there is a lot of simplification still available

@kabel42 @mirabilos @rl_dane @thedoctor @amin

Yeah the fucker that decided that "ennui" is a good word should be taken behind the shed...

@sotolf @kabel42 @rl_dane @thedoctor @amin more like

  • English (with stiff upper lip)
  • English (slurring what is supposed to be hard consonants)
@sotolf @mirabilos @rl_dane @thedoctor @amin thats why machine translation with more context works much better :)
deepl is actually pretty good at german<->english if you give it enough context.
@kabel42 @sotolf @rl_dane @thedoctor @amin most of the time I still use LEO (“link everything online”, hah those were the times…) because they show more variety in meanings, even if they are lacking a lot sometimes…
@kabel42 @sotolf @rl_dane @thedoctor @amin (and ofc I read a lot and get understood context for when to use which words that way, by immersion)
@mirabilos @sotolf @rl_dane @thedoctor @amin afaik the translation is ml and deep neural networks not llm
@mirabilos @sotolf @rl_dane @thedoctor @amin and trained on legally obtained translations
@kabel42 @mirabilos @rl_dane @thedoctor @amin I have heard both the one and the other, the thing is it's not very accurate with my native tongue at least.
@sotolf @mirabilos @rl_dane @thedoctor @amin as i said, they are pretty good for german<->english, i can't judge other language pairs
@kabel42 @mirabilos @rl_dane @thedoctor @amin I mean if you speak both you have no use for it, if you don't you have no basis to judge it on, so it's safest just never to use it. It's a warning that if you ever read something auto-translated from the scandinavian languages, it's probably missed a ton of neuances, and added or subtracted stuff that wasn't there.
@mirabilos @sotolf @rl_dane @thedoctor @amin they have a lot of "AI" on their website now, i wonder how much of that is selling ml as ai because bank want to throw money at ai but not ml.
@kabel42 @mirabilos @rl_dane @thedoctor @amin Not really, I challenge you to read any app description in the google play store in norwegian without getting eye and/or soul cancer, it's impossible, machine translation is complete and utter garbage, and will never be good enough in our lifetime..
@kabel42 @sotolf @rl_dane @thedoctor @amin different languages evolve the splits between words and assigned meanings differently over time ( @yvanspijk has wonderful infographics on these things). So if you want to translate bron to German, or English for that matter, you need to distinguish between “spring” (the water one) and “reference” (the origin-of-citation one). Now “spring” can also be “Feder” (e.g. the one in a Kugelschreiber), but “Quelle” cannot… you get my point?

@kabel42 @mirabilos @sotolf @thedoctor @amin

If you rely on relativistic/Einsteinian accuracy, yes? ;)

#KSP cheats by not computing gravity between the various planets and moons. They're all on (invisible) rails. Only ships, crew, and asteroids are affected by actual gravity.

@rl_dane @mirabilos @sotolf @thedoctor @amin but your assumption when using Newtonian physics would be, that the error from doing so is irrelevant.
@kabel42 @rl_dane @mirabilos @thedoctor @amin Yeah, but you're doing less work, so you're basically cheating ;)

@sotolf @kabel42 @mirabilos @thedoctor @amin

Sometimes the cheats are a valid way to make a system more efficient ;)

https://fosstodon.org/@RL_Dane/110483983267674662

R. L. Dane :debian: :openbsd: (@[email protected])

Attached: 1 image @[email protected] HA :) Reminds me of something I saw today... #LossyPNG

Fosstodon
@rl_dane @kabel42 @sotolf @thedoctor @amin hmmmm, would be fun if a planet is so barely near its rails that a starship moving around would be enough to derail it, so to speak

@mirabilos @kabel42 @sotolf @thedoctor @amin

That game uses all kinds of crazy tricks to keep the various calculations away from floating point dead zones.
Folks have found tricks to force KSP to plot things with reduced precision, and the outcome is kind of hilarious. Things like very jagged plots and incredibly unpredictable trajectories. ;)