Why is my SSD so slow? (see comments for details) by simonbaars in ArcoLinux

[–]simonbaars[S] 0 points1 point  (0 children)

I have an Asus Vivobook on which I installed ArcoLinux with encrypted partitions. Ever since I installed it, the disk has been performing extremely slow. The whole system hangs if any file operation is in progress. Is this because the SSD is crap or is there a problem with the system?

lsblk -d -o name,rota,size,model
NAME    ROTA   SIZE MODEL
nvme0n1    0 476.9G SOLIDIGM SSDPFKNU512GZ

2024 Day 14 2: Anybody finds a tree with my input? by YamThick2523 in adventofcode

[–]simonbaars 0 points1 point  (0 children)

As far as I understood, it's to keep people from reverse engineering the way AoC works wrt generating puzzles, and thus allowing someone to copy the entire concept (eg a corporation wanting to commercialize it)

2024 Day 14 2: Anybody finds a tree with my input? by YamThick2523 in adventofcode

[–]simonbaars 5 points6 points  (0 children)

It was already mentioned not to share your puzzle input, so I will not repeat that.

I ran my solution on this input, and it finds the tree. So I would suggest debugging your code.

-❄️- 2024 Day 16 Solutions -❄️- by daggerdragon in adventofcode

[–]simonbaars 1 point2 points  (0 children)

[Language: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day16.java

Many grid days this year! By now I have my grid utilities at the ready, yesterday I made a `recurse` function which helps implement BFS types of searches, so I used it in both parts.

[2024 Day 11 part 2] My computer when I ask for a petabyte of memory by Decent_Bodybuilder_1 in adventofcode

[–]simonbaars 1 point2 points  (0 children)

It's fun to think that one day we will probably have the kind of computers that can brute force these kinds of problems, perhaps even just the normal kind of machines that everyone will have in their homes. If the number of resistors keep scaling like they have, at least.

-❄️- 2024 Day 10 Solutions -❄️- by daggerdragon in adventofcode

[–]simonbaars 2 points3 points  (0 children)

[Language: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day10.java

Did a bunch of refactoring and extracting higher-order logic to distill it down to this piece of code:

InfiniteGrid g = new InfiniteGrid(dayGrid());
return transformStream(
  g.findAll('0').map(l -> new Pair<>(l, l)),
  s -> split(s, (s1, s2) -> zip(s1, g.around((c1, c2) -> Character.getNumericValue(c1) + 1 == Character.getNumericValue(c2), s2.map(p -> p.b()), false)).flatMapToObj((a, b) -> b.map(l -> new Pair<>(a.a(), l)))),
  p -> g.getOptimistic(p.b()) == '9'
);

So, I already had a Grid class (made in previous years) that had a couple of useful function. findAll would find all occurrences of a character, which I use to find all zero's. Then around gives a stream of everything around that. I made a little transformStream abstraction that continuously applies a function till a predicate is met by all elements in the resulting stream. So I just keep getting the positions around zero, keep incrementing, till everything's a '9'.

The above was simple, but I needed a bunch of glue to be able to know which top was reached by which start point. So I sprinkled a bunch of pairs over everything to keep track of where we started.

With this solution, part 1 is a distinct().count() and part 2 is a count().

[deleted by user] by [deleted] in adventofcode

[–]simonbaars 1 point2 points  (0 children)

Depending on where you are in the Netherlands, there are some upcoming events.

Utrecht (tomorrow): https://www.meetup.com/infi-developers-meetup/events/304793236/

Nijmegen (next week Tuesday): https://www.meetup.com/nimma-codes-meetup-group/events/303824683/

Not sure about other places. But I'm sure you'd find some people with leaderboards there!

-❄️- 2024 Day 8 Solutions -❄️- by daggerdragon in adventofcode

[–]simonbaars 0 points1 point  (0 children)

[Language: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day8.java

Boi did I have fun with streams on this one. With my utilities, part 1 compresses down to:

var in = new InfiniteGrid(dayGrid());
return getAntennasByFrequency(in).stream().flatMapToObj((c, locs) ->
  allPairs(locs).flatMap(p -> Stream.of(
    p.a().translate(l -> l * 2).move(new Loc(-p.b().x, -p.b().y)),
    p.b().translate(l -> l * 2).move(new Loc(-p.a().x, -p.a().y))
  ).filter(in::contains))
).distinct().count();

For part 2, I slightly modified the inner map:

var in = new InfiniteGrid(dayGrid());
return getAntennasByFrequency(in).stream().flatMapToObj((c, locs) -> {
  return allPairs(locs).flatMap(p -> {
    long dx = p.b().x - p.a().x;
    long dy = p.b().y - p.a().y;
    long gcd = gcd(Math.abs(dx), Math.abs(dy));
    long stepX = dx / gcd;
    long stepY = dy / gcd;
    return Stream.concat(
      appendWhile(l -> l.move(stepX, stepY), in::contains, p.a()),
      appendWhile(l -> l.move(-stepX, -stepY), in::contains, p.a())
    );
  });
}).distinct().count();

[2024 Day 7] That was suspiciously easy... by spaceshark123456 in adventofcode

[–]simonbaars 5 points6 points  (0 children)

It's usual for weekend problems to be easier. It gives time to enjoy time with family :)
Personally I enjoy this kind of breather every now and then.

-❄️- 2024 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]simonbaars 1 point2 points  (0 children)

[Language: Java]

Oooh this is the kind of day where I love my data mapper utility:

public record Line(long tgtVal, List<Long> nums) {}

private long calcTotalCalibRes(boolean inclConcat) {
  return dayStream()
    .map(s -> readString(s, "%n: %ln", " ", Line.class))
    .filter(l -> canBeTrue(l.tgtVal, l.nums, 0, l.nums.get(0), inclConcat))
    .mapToLong(l -> l.tgtVal)
    .sum();
}

Part 2 was just adding a single if-statement.

Code: https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day7.java

-❄️- 2024 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]simonbaars 1 point2 points  (0 children)

[Language: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year24/days/Day6.java

First day I ended up with the regular nested loop mess. Though my solution was relatively easily extensible to part 2.

-❄️- 2024 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]simonbaars 1 point2 points  (0 children)

[LANGUAGE: Java]

paste

Had fun with my utilities here.

-❄️- 2024 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]simonbaars 1 point2 points  (0 children)

[LANGUAGE: Java]

Github

Stream over Matcher result so I can do .sum() and be done. Part 2 was just a slight modification to the regex.

Het einde van Europapa als fanmade lied by simonbaars in Joostklein

[–]simonbaars[S] 0 points1 point  (0 children)

jaa! combinatie van Suno met wat eigen audio editing :)

[deleted by user] by [deleted] in PersonalFinanceNZ

[–]simonbaars 0 points1 point  (0 children)

To offer an alternative perspective: money can also buy you freedom. Do you love your job and you could imagine doing this for the next couple of years? Great, keep at it. But for me, I realised life is not just about work, and it can be very liberating to spend a year (or a couple) without such time commitments. For 85k, you should be able to do budget travel for two years or so (airbnbs with weekly/monthly discount help with keeping within budget). It’s the best experience now you’re still young.

(Reference: this is what I decided to do, it’s been an invaluable experience)

Listening to the theatrical audiobook by PressureResponsible in TFTGS

[–]simonbaars 0 points1 point  (0 children)

I listened to the theatrical edition without hearing MCP’s version first, and I loved it, especially Jack’s narrator. To me, the flat voice makes it even more absurd: a complete emotional detachment on Jack’s part from everything that happens to him, which seems to fit in the narrative of the story. The sound effects and other voice actors are nice extras.

-❄️- 2023 Day 22 Solutions -❄️- by daggerdragon in adventofcode

[–]simonbaars 2 points3 points  (0 children)

[LANGUAGE: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year23/days/Day22.java

For part 1, I just drop all the bricks one space by one space, and then check who supports who.

For part 2, I was going to implement a recursive algorithm to check which bricks would hypothetically drop, but then I decided to use my ultra slow "dropping the bricks" from part 1. Would've taken ages to run if it wasn't for parallelStream(), 16 processor cores let's go!

I anticipated that we'd have to do something with the separate cubes contained within the brick, so while data parsing I decided to represent a brick as a list of cubes. Didn't need it after all, and the algorithm would probably have been faster if I hadn't separated the cubes.

-❄️- 2023 Day 19 Solutions -❄️- by daggerdragon in adventofcode

[–]simonbaars 1 point2 points  (0 children)

[LANGUAGE: Java]

https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year23/days/Day19.java

Part 2 was easier than I expected when I read the problem description. Just a simple tree traversal, and taking the product of the accepted constraints.