Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)TR
Posts
1
Comments
72
Joined
2 yr. ago

  • Rust

    https://github.com/Treeniks/advent-of-code/blob/master/2023/day21/rust/src/main.rs

    I reused my Grid struct from day 17 for part 1, just to realize that I'll need to expand the grid for part 2 so I awkwardly hacked it to be a Vec> instead of a linear Vec.

    I solved task 2 by reading through the reddit thread and trying to puzzle together what I was supposed to do. Took me a while to figure it out, even with literally looking at other people's solutions. I wrote a lengthy comment about it for anyone that's still struggling, but I honestly still don't really understand why it works. I think I wouldn't have solved it if I didn't end up looking at other solutions. Not a fan of the "analyze the input and notice patterns in them" puzzles.

  • I'm a little confused about this one. The mappings are total, that is any number that is not defined explicitly gets mapped to itself. So it's easy to create an example where the lowest number does not get mentioned within a range:

     text
        
    seeds: 0 3
    
    seed-to-soil map:
    10 0 2
    
    soil-to-fertilizer map:
    100 200 5
    
    fertilizer-to-water map:
    100 200 5
    
    water-to-light map:
    100 200 5
    
    light-to-temperature map:
    100 200 5
    
    temperature-to-humidity map:
    100 200 5
    
    humidity-to-location map:
    100 200 5
    
    
      

    Here, we have seeds 0, 1 and 2. seed 0 gets mapped to location 10, seed 1 gets mapped to location 11 and seed 2 gets mapped to location 2. That means location 2 would be the answer, but it's not a start of any range. I guess this just doesn't happen in any of the inputs?

    EDIT: actually it's double weird. If you implemented a backwards search, that is you create reverse mappings and then try out all locations (which is what I and many others did), the result of the above example is location 0, whereas if you create a forwards brute force of all seeds, the result is 2. For the reverse approach to work in all cases, the mappings would have to be bijective.

  • I'm aware of nautilus-admin, but not only is it not maintained, imho it should be part of nautilus by default, and it has to open a new nautilus window when you use it. What I want is to drag and drop files to /usr/local and then get a password prompt to do the move. With nautilus-admin, I need to have the foresight to use "Open as admin" when going into /usr/local, but if I had that foresight then I might as well just start nautilus as root to begin with. Usually I just want to look into the folder, and only then realize I need to change something, which means a good old "go back up one folder, then search the local folder again, then right click, search for 'Open as admin', then get thrown into a new window, completely disorienting myself in the process".

  • Personally I never understood why file managers in linux refuse to do operations that require privileges. Guess what, if I have Nautilus open and want to move files into, let's say, /usr/local, I don't want to have to switch to the terminal to do so if I already have the stuff copied within nautilus. On Windows, I just get an admin password prompt if I try to do naughty stuff. On Linux, we have the whole polkit system, but no file manager seems to ever use it. Tbf, this is not a nautilus problem, as no file manager seems to do this.

  • Actually when it comes to C++ 23 library features, MSVC is ahead of both. In fact, as far as I can tell, MSVC is the only compiler that fully supports all C++ 20 core language features at the moment. So credit where credit is due, MSVC has gotten way way better the past few years. Visual Studio is still awful, but the compiler has become quite competent.

  • Haven't seen anyone mention the Zed Text Editor yet. It's only available on MacOS as of now, but I've tried it out a bit and once it's more mature (and available on other OSes), I might switch over from Sublime Text. It's got a similar speed as Sublime, but with LSP, vim emulation and collaboration features built in, whereas in Sublime I need to install packages to achieve the same. Also made by the same people who originally made Atom and Treesitter.

    I also want to mention Onivim. Unfortunately, development has stopped, so it's not really a viable option anymore, but I loved the idea. The idea was to make a vscode/vim hybrid. To that extend, it's written in Reason which allowed them to support vscode extensions, thus they didn't have to create their own extension ecosystem, while still being faster than electron. As for the vim part, the entire editor could be controlled with a keyboard. They had a global shortcut to go into a "UI move mode" so to say, which allowed you to go to every single piece of UI you had on screen. Thus they were able to copy the vscode UI, but still be keyboard-only. It was a surprisingly effective idea, so I hope some people can revive it someday.

  • The way UTF-8 works is fixed though, isn't it? A new Unicode standard should not change that, so as long as the string is UTF-8 encoded, you can determine the character count without needing to have the latest Unicode standard.

    Plus in Rust, you can instead use .chars().count() as Rust's char type is UTF-8 Unicode encoded, thus strings are as well.

    turns out one should read the article before commenting

  • I've turned off Updates with group policies and have not had an issue with that ever since Windows 10 got released. Afaik the same can be done with registry when on Windows Home. It will still check for updates, but if set up correctly it should not download nor install them.