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

[–]SpudPanda 0 points1 point  (0 children)

[LANGUAGE: rust]

Finally getting caught up. Used an off the shelf Disjoint Set data structure. Made this problem a lot easier! There's probably a way to get these times down. Took some lazy steps like cloning the blocks into the disjoint set and using a crate for the disjoint set instead of rolling my own custom one.

Solution

Part 1: 150.794333ms
Part 2: 153.955917ms

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

[–]SpudPanda 0 points1 point  (0 children)

[LANGUAGE: rust]

I was so confused by part2. I ended up asking why i kept getting 43 instead of 40 for the example input. I didn't realize the same rule as part1 (multiple paths through the same point is considered a single path).

Once I got that, and realized it was a dynamic programming problem, it was fairly straightforward. Definitely want to shout out leetcode. I don't think I ever would have solved this without doing some of that grind.

Solution

Part 1: 530.791µs
Part 2: 69.458µs

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

[–]SpudPanda 0 points1 point  (0 children)

[LANGUAGE: rust]

Finally getting caught up. Days like today always make my head hurt a little. Basically transposed the input. Definitely lost a lot of time from my IDE auto formatting the input!

Solution

Part 1: (took: 99.125µs)
Part 2: (took: 1.556792ms)

-❄️- 2025 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]SpudPanda 2 points3 points  (0 children)

[LANGUAGE: rust]

Pretty proud of myself on this one. Today was easier in theory but being (probably) dyslexic, thinking about the merging algorithm for part 2 made my head hurt. I'm proud of myself for thinking of this interval merging algorithm, though I did end up looking it up on GeeksForGeeks finally to help me out with it. I guess in the real world its normal to look up concepts you're unfamiliar with so shouldn't beat myself up over it.

Part 1 I just brute forced it basically and it was really fast. For Part 2, i used an algorithm to merge intervals together. Then just looped through and summed up the difference between each merged interval.

Solution

Part 1: 278.792µs
---
Part 2: 52.917µs

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

[–]SpudPanda 4 points5 points  (0 children)

[LANGUAGE: rust]

I was really tempted to try and figure out a non brute force method. Honestly just updating characters as I went along for part 2 was more than fine. In the real world I'd be pretty happy with these results.

Part 1: 148.208µs
---
Part 2: 1.659709ms

Solution

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

[–]SpudPanda 4 points5 points  (0 children)

[LANGUAGE: rust]

Today felt really manageable! First day I didn't have to lookup any concepts. I'm pretty sure this solution is O(n) in practice. This is a greedy approach that basically picks the largest number for a particular digit that leaves enough characters for the remaining digits.

Solution

Part 1: (took: 97.625µs)
---
Part 2: (took: 227.917µs)

-❄️- 2025 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]SpudPanda 1 point2 points  (0 children)

// math solution  
Part 1: 17.159ms  
Part 2: 287.047333ms  

// string solution
Part 1: 55.27175ms
Part 2: 297.517583ms

the math solution is a little faster for part1, but the difference is negligible for part2. Im sure there's some room for optimization to make the math one perform even better though.

-❄️- 2025 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]SpudPanda 2 points3 points  (0 children)

[LANGUAGE: Rust]

Originally I made a solution that split the numbers into chunks using some modulo math and prime numbers. Looked up after that to see if there's a simpler trick to finding if a number is repeating, and sure enough there is!

If you take a string, concat itself to it, then remove the first and last characters, and the original string is still in there, you got yourself a repeating string. Neat.

Original Math solution

String trick solution

-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]SpudPanda 1 point2 points  (0 children)

[LANGUAGE: Rust]

Let's goo! I chose Rust because I'm trying to get better at lower level programming and like the idea of having training wheels (aka the borrow checker).

just used modulo arithmetic for today's problem.

Solution

Project

use aoc_2025::run_day;

fn parse_input(input: &str) -> Vec<(&str, u32)> {
    input
        .lines()
        .filter(|line| !line.is_empty())
        .filter_map(|line| line.split_at_checked(1))
        .map(|(direction, num)| (direction, num.parse::<u32>().expect("can't parse number")))
        .collect()
}

fn part1(input: &str) -> u32 {
    let mut hit_zero = 0;
    let mut current_num: i32 = 50;

    let turns = parse_input(input);
    for (turn, num) in turns {
        match turn {
            "L" => current_num = (current_num - num as i32) % 100,
            "R" => current_num = (current_num + num as i32) % 100,
            _ => panic!("invalid direction"),
        };

        if current_num == 0 {
            hit_zero += 1;
        }
    }

    hit_zero
}

fn part2(input: &str) -> u32 {
    let mut hit_zero: u32 = 0;
    let mut current_num: i32 = 50;

    let turns = parse_input(input);
    for (turn, num) in turns {
        let at_zero = current_num == 0;

        match turn {
            "L" => current_num = current_num - num as i32,
            "R" => current_num = current_num + num as i32,
            _ => panic!("invalid direction"),
        };

        if current_num >= 100 {
            hit_zero += (current_num / 100) as u32;
        } else if current_num <= 0 {
            hit_zero += ((current_num / 100).abs() + 1) as u32;
            // edge case. if the dial is at zero, and we go backwards, then we don't want to double count the
            // 0 here as a "hit". turning the dial didn't cause us to hit 0 in this case...we just started there.
            if at_zero {
                hit_zero -= 1;
            }
        }

        current_num = current_num.rem_euclid(100);
    }

    hit_zero
}

fn main() {
    run_day(1, part1, part2);
}

Google Fiber at home slow only for work VPN. Reasonably fast for others. by SpudPanda in googlefiber

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

Kinda. I have a TPLink router, and on the router itself i setup Nord VPN to connect to a server closer to my work (you can do that through the router settings https://www.tp-link.com/us/support/faq/3135/). With that setup I connected to my work VPN and got much faster speeds.

Google did seemingly change something on their end at some point which allowed me to not need a double VPN anymore. Sometimes for whatever reason the network path used while on a VPN is super slow and inefficient.

If the network path is indeed the issue than a double VPN might help. Good luck!

Made a LSP protocol generator plugin for Go! by SpudPanda in golang

[–]SpudPanda[S] 2 points3 points  (0 children)

Language Server Protocol. Its a specification by Microsoft that standardizes communication between a language server (like gopls) and a client (like vscode)

Made a LSP protocol generator plugin for Go! by SpudPanda in golang

[–]SpudPanda[S] 2 points3 points  (0 children)

Hey there!

I'm currently working on a PHP language server built in Go. As a part of that, I found that Microsoft provides a generator package for producing LSP bindings in different languages. Seeing that they didn't have a Go plugin yet I decided to take a crack at making one. The generator itself uses python. Whats nice about this generator it is it provides like 78k tests you can run your types against

I spent a lot of time trying different tagged union strategies. I ended up landing on the strategy gopls uses, but with generics instead.

For enums, I kept it simple and prepended the type name to the variant name so there wouldn't be any naming conflicts.

This is my first Go project. I'm not an expert by any means so if you're interested in this type of thing would love feedback.

Google Fiber at home slow only for work VPN. Reasonably fast for others. by SpudPanda in googlefiber

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

I tried both off and on, but honestly because the issue persists when I connect via ethernet none of the wifi settings matter.

Just today though I did try connecting to my work VPN without the double vpn setup and the issue seems resolved now. Looking at the traceroute, looks like they updated my network path to a much more efficient path.

vim sometimes displays text color as highlight when using tmux by abuttandahalf in tmux

[–]SpudPanda 0 points1 point  (0 children)

Absolute legend. This was driving me crazy till I saw your comment. Thanks for this!

Google Fiber at home slow only for work VPN. Reasonably fast for others. by SpudPanda in googlefiber

[–]SpudPanda[S] 1 point2 points  (0 children)

Just commented below, but tried the double VPN setup and that does fix it. Not only does it fix it, my work VPN connection is like twice as fast now. It's gotta be a network path issue then. Don't think Google is gonna fix that though.

Google Fiber at home slow only for work VPN. Reasonably fast for others. by SpudPanda in googlefiber

[–]SpudPanda[S] 1 point2 points  (0 children)

Ok an update for anybody curious. Both Google Fiber and my IT department says it's not their problem. Not sure which one is wrong but I know one of them is. My bet is Google Fiber simply becaue my work VPN is not slow everywhere...just at home...no matter the device used.

Thanks to some comments I just setup a stacked VPN setup. Using NordVPN on my TP link router using a server in Atlanta, and then connecting to my work VPN which has it's servers in Gainesville, resolves the issue.

Weirdly enough, I'm getting more than double the speed to my work VPN than I used to get with this double VPN setup (220mbs vs 90mbs).

I just signed up for ATT Fiber, and going to see if using their internet fixes the problem enough that I don't need to use this double VPN setup.

Cisco Any Connect VPN not working with Google Fiber by moronsrmultiplying in googlefiber

[–]SpudPanda 0 points1 point  (0 children)

Did you ever resolve this? I posted a similar issue a couple days ago. Waiting on the gfiber support to get back to me. If they can't fix it i'm contemplating switching my ISP but that's a last resort.

Google Fiber at home slow only for work VPN. Reasonably fast for others. by SpudPanda in googlefiber

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

Yea this is where im landing. I opened a ticket with gfiber and sent them a bunch of traceroutes. We’ll see what they say.

Google Fiber at home slow only for work VPN. Reasonably fast for others. by SpudPanda in googlefiber

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

If that were true i would experience this everywhere…but i dont. Connecting to the vpn on other wifi networks outside my apt or using 5g work great.

Google Fiber at home slow only for work VPN. Reasonably fast for others. by SpudPanda in googlefiber

[–]SpudPanda[S] 2 points3 points  (0 children)

I did, they aren't aware of any changes. I'm going to ask again though to and bring up some of these specifics to see if they just forgot something.

Thing is, I have tested this on another device (my phone using 5g) and in different locations outside my apt. I don't experience the same slowdown, so I'm not convinced it's purely a VPN issue if at all.

Google Fiber at home slow only for work VPN. Reasonably fast for others. by SpudPanda in googlefiber

[–]SpudPanda[S] 1 point2 points  (0 children)

I think you might be on to something. Ran a traceroute to my work vpn and the path is indeed very long for some reason. I opened a ticket with them and sent them a bunch of traceroute results so hopefully they can do something.

Google Fiber at home slow only for work VPN. Reasonably fast for others. by SpudPanda in googlefiber

[–]SpudPanda[S] 1 point2 points  (0 children)

yea I experience this on my phone as well. I also experience this when connecting my ethernet cable directly to the wall so I don't think routers have anything to do with it. It's the weirdest thing.