isti115

joined 2 years ago
[–] isti115 2 points 1 month ago* (last edited 1 month ago)

#FSharp https://github.com/isti115/advent-of-code/tree/master/2024/day-01

I usually choose to learn a new language each year using these great little puzzles, this time it's FSharp. This naturally means that my solutions will be poorly written at first, since I'm not yet familiar with the language and make do with what I have. For example I'm pretty sure that there should be a better way to parse today's input instead of this monstrosity:

let pairs = lines |> Seq.map (fun l -> Regex.Matches(l, "(\d+)\s+(\d+)"))

let numpairs =
    pairs |> Seq.map (Seq.head >> _.Groups >> Seq.tail >> Seq.map (_.Value >> int))

let numtups = numpairs |> Seq.map (fun p -> (Seq.head p, p |> Seq.tail |> Seq.head))

~~Also, I was pretty surprised that I couldn't find the unzip function for sequences. I would've expected that to be present after using some other functional languages, such as Haskell and Scala. πŸ€”~~

Edit: Scratch that, I just need to convert the sequence into a list first... πŸ€¦β€β™‚οΈ It actually makes complete sense. https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-listmodule.html#unzip Also, I have managed to clean up the parsing a little bit.

2
2024 / DAY 01 - Solutions (self.adventofcode)
submitted 1 month ago* (last edited 1 month ago) by isti115 to c/adventofcode
 

Feel free to share your solutions or browse others' for inspiration! Please tag your comments with the language you solved in to make it easier to search for specific languages in case we happen to get more comments than expected. πŸ˜€ I really hope that we can create some discussion here to liven up this community!

 

In preparation for this year's event I started to create a utility library and realized that I might not even need to care about decimal, or even fractional numbers, as I don't remember ever encountering them while solving a problem so far. Does anyone have any examples for problems which required using floating point calculations? Is it maybe even explicitly stated that they are not needed? (I remember that Google Code Jam had some statistical problems where the solution didn't have to be exact, just within an acceptable error margin, but that isn't likely to happen here, right?)

10
submitted 2 months ago* (last edited 2 months ago) by isti115 to c/gimp
 

We're getting really close, which is great to see, as I'm going be teaching about graphics tools (GIMP for raster [maybe a tiny little bit of Krita as well], Inkscape for vector) at a workshop in November, and will be more than happy to show off the new non-destructive editing capabilities! :)

 

I remember that way back around 2015 the double XP boost used to stack, so you could get a 4x multiplier, but I don't think that I've ever got a triple.

 

It seems that they have accidentally posted the announcement earlier than intended, but it will probably show up later during the day.

[–] isti115 1 points 10 months ago (1 children)

Thanks for your input! To me it seems like Nemo only counts the direct descendants and doesn't recurse, which makes it less useful for this purpose, but still nice to know!

[–] isti115 3 points 10 months ago

Thank you for the idea! I didn't know about the --inodes flag before, this seems like a viable solution for systems where I can't / don't want to install additional software!

[–] isti115 3 points 10 months ago* (last edited 10 months ago)

Oh, wow, thank you! I had ncdu installed, but it was an older version, which didn't yet have this feature. Now that I updated to the newest (Zig based πŸŽ‰) release this looks perfect for my needs!

 

There are plenty of utilities (GUI, such as filelight and TUI, such as dua as well) for analyzing disk usage by space, but I would like to view my folders based on the count of files, as I'm making backups, and folders with lots of small files (e.g. node_modules) take very long to move around, so I guess that I'd be better of compressing those into a single file before archiving, as it's already highly unlikely that I'll need to access them anyway. Thanks for any pointers in advance!

[–] isti115 2 points 1 year ago (1 children)

Thanks! πŸ˜€ I've been meaning to post about that as well in order to keep feeding Lemmy with content, but couldn't find either an active alternative to ErgoMechKeyboards or Battlestations. πŸ€”

[–] isti115 3 points 1 year ago* (last edited 1 year ago)

Well, I'd suggest asking around your nearest toddler, that's how I managed to borrow this one. πŸ˜€ Probably it has been inherited through several generations, that might explain it's wisdom!

[–] isti115 7 points 1 year ago* (last edited 1 year ago)

Thanks for the advice, but lo and behold, the issue was actually caused by a newly introduced generic parameter not being defined after a dependency update. πŸ™ƒ Oh, the wonders of the JS/TS ecosystem...

[–] isti115 3 points 1 year ago

Whoa, I just checked out some images, that one is on another level as well for sure. πŸ˜€ If he's as good at fighting bugs as criminals, you're in good ~~hands~~ wings!

211
submitted 1 year ago* (last edited 1 year ago) by isti115 to c/[email protected]
 

If the rolling wooden variant still turns out not to be enough, I might need to source a real live duck. πŸ¦† Not sure how patient that would be at listening to me explaining code though. πŸ€”

[–] isti115 2 points 1 year ago (1 children)

Let me preface this by clarifying that I don't claim to have the one and only right explanation that everyone should accept, I'd just like to point out that this theory also exists: https://hermeneutics.stackexchange.com/a/43799

[–] isti115 1 points 1 year ago

Yes, quite the role reversal between the parts from yesterday. πŸ˜€

[–] isti115 6 points 1 year ago* (last edited 1 year ago)

Yepp, "Lateral with Tom Scott, Episode 58: Straight-line sports" in case anyone's looking for it. https://lateralcast.com/

[–] isti115 2 points 1 year ago* (last edited 1 year ago) (1 children)

River is actually really nice! I have been a Sway user for multiple years before, but as it reached parity with i3, it was deemed "feature complete" (which is reasonable, as it was made to be a drop-in replacement), so I switched to Hyprland, but after making a small contribution I found the development too chaotic, so I started looking for something else.

I have been really happy with River. It still has some small shortcomings (e.g. minor visual glitches with fullscreening, and some less used options still missing), but the developers are very responsive on IRC (which I'm actually not a huge fan of, this was the first time I had to use it, but it's OK for what it is) and it being written in Zig is a huge selling point for me, as I don't have to write any C or C++ to extend it (my first PR is already on the way) when something I'd like to do is not yet possible.

If you're willing to spend a while getting to know it and setting up the environment (it relies on external programs for some functionality that is built-in in other compositors, such as monitor management), then I'd definitely say that it's worth a shot!

 

After getting a comment from the creator of kanata (an awesome piece of software by the way) that he found my story amusing, I figured that I'd also post it here, partly as fun, partly as a cautionary tale. Also, I'd appreciate any tips as to what to check for in my system, it's a weird feeling to know that some stuff might have been messed up under the hood.

 
view more: next β€Ί