Skip Navigation

Posts
4
Comments
221
Joined
2 yr. ago

  • Day 17: Clumsy Crucible

    Intimidating at first, so I went shopping for christmas presents first, which engaged my brain juices.

  • Vigorous mask-dropping very early on in the post:

    The term "eugenics" has absorbed so much baggage over the last century that it somehow refers both to swiping right on Tinder when you see an attractive person and to the holocaust.

    Not all dating is done with reproduction in mind. What are members of the opposite, or indeed same gender: baby synthesis apparatus? Unless you go out of your way in selecting blue eyed, blond haired people, restricting the definition of beautiful to these people, and restricting the teleology of tinder to the begetting progeny, how is it even remotely eugenics?

    EDIT: Uncharacteristically for LW the post, was very short short, "very early" is actually about midway in a proposal of little substance, also choosing attractive partners doesn't guarantee ensure children anyway (unless using very specific definitions of beauty).

  • How about not fiddling with indices?


    Similarly tired with index fiddling, I was pretty happy with my approach, which led to satisfying transpose cancelling in part 2. Not the fastest code out there, but it works. Day 14 was actually my favorite one so far ^^.

  • A nice workaround to jq single threadedness, since this is maq reduce and safe to parallelize. 17m10s -> 20s !!! ::: spoiler Spoiler link to commit. https://github.com/zogwarg/advent-of-code/commit/fef153411fe0bfe0e7d5f2d07da80bcaa18c952c :::

    Not really spoilery details: Revolves around spawing mutiple jq instances and filtering the inputs bassed on a modulo of number of instances:

     
        
      # Option to run in parallel using xargs
      # Eg: ( seq 0 9 | \
      #        xargs -P 10 -n 1 ./2023/jq/12-b.jq input.txt --argjson s 10 --argjson i \
      #      ) | jq -s add
      # Execution time 17m10s -> 20s
      if $ARGS.named.s and $ARGS.named.i then #
        [inputs] | to_entries[] | select(.key % $ARGS.named.s == $ARGS.named.i) | .value / " "
      else
        inputs / " "
      end
    
      

    I use JQ at work, and never really needed this, i guess this trick is nice to have under the belt just in case.

  • Day 12: Hot springs

    https://adventofcode.com/2023/day/12

    • Leaderboard completion time: 22:57
    • Personal completion time: ahahahahahahaha (at least i had fun)

    Where a curse the fact I decided to use JQ and not a "real" programming language.

  • Ah! Thanks for making my notice the GCM -> GCD typo. I'm not gunning for the leaderboards myself, it's pretty hopeless ^^. Yes i am assuming based off of experience and utility tools.

    I myself have tools to automatically get the inputs, and submit outputs, but that's more because it pleases me than to actually be fast: https://github.com/zogwarg/advent-of-code/blob/main/functions.sh

    (Also completely pointlessly have a functions to extract the session cookie from chrome storage from the CLI, despite being long-lived, and therefore much simpler to simply copy-paste from debugger window)

  • Cleaned up version of code used to solve part 2 in jq.

  • The main catch is it would often be faster to use a "real" programming langage ^^, both in writing the code, and in execution time for some loop heavy examples: equivalent code that completes say in 1 second in python, completing in 1 minute in jq. Also missing a way to call native libraries, to do stuff like say "md5" (relevant) in past years advents-of-code.

    That being said i like the general "pipe", map-reduce feel of the language. Like bash one-liners It can make for very terse implementations. I like to add comments, and indentation to make it readable though.

  • I liked the slight trickiness of part 2, that the naive implementation would never complete in time.

    As always doing a JQ implementation:

    Replaced less-than (and greater-than for symmetry) symbols with full-width version, since lemmy apparently doesn't handle them well within a code block: replacing less than with lt;

  • Back to a more straightfoward day, do they make them harder on the weekends?

    Day 4 Scratchcards

  • Have been mostly using jq for fun.

    Day 1

    First part was easy, and very suited to jq

    Second part was harder than expected, i had to resort to regex.

    Day 2

    Not too much trickery in this example.

    Satisifyingly straightfoward edit form part one.

    Day 3

    Took More time than i expected, glad i had the idea early to search by the indices of the symbols and not the digits. Not super well suited to jq, unless I'm missing a better solution.

    Not too far of an edit from part one.

  • One (simpler) explanation is that proving an absence of something is almost impossible, and that attempting too hard would make them look a heck of a lot guilty.

    There is a good reason why the burden of evidence is “innocent until proven guilty”, and yes this extends to the (in your eyes) untrustworthy.

    Prove to me you never stole candy from a store as a child (or if you did, replace that accusation with any item of higher value until you hit something you did not steal)

  • One of the more disturbing things that happened at work when using MS Word, was the automatic addition of alt-text images. I didn't ask for that, I didn't click any "Please send my images to the cloud, possibly leaking sensitve material, so inference can be run there, to add potentially unhelpful descriptions"

    Is document editing really a task that benefits from AI?

    An example of unhelpfulness:

    I'm torn between at almost praising meek half-assed attempt at accessibility, and shrieking to the heavens about this unweclome shoe-horned addition.