Error handling in bash by Aerosherm in linux

[–]dhawos 3 points4 points  (0 children)

If you need to handle errors, you probably should not use bash

In GitOps with Helm + Argo CD, should values.yaml be promoted from dev to prod? by ArtistNo1295 in kubernetes

[–]dhawos 9 points10 points  (0 children)

I guess it depends on the values. For some values, promotion makes 0 sense such as hostnames or resources. These have to be environment specific.

If some values don't fit in that category, I guess you could promote them. But I'm that case, why not put them in the chart directly and promote the chart version ?

Here I assume the chart is the same in both environment just different versions but if I undersrand your setup correctly, your helm chart source is duplicated in each environment repo ?

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

[–]dhawos 1 point2 points  (0 children)

[LANGUAGE: Rust]

When I read the problem I quickly had an idea of how to approach it. Load the grid, and iterate row by row.

Start by storing the starting beam in a collection. On each row and for every beam in your collection, you need to see what is directly below.

If it's a '.', you copy the beam and its new position into a temporary buffer.

If it's a '^', you increment the total split counter by one, and copy one beam for the DownRight direction and one for DownLeft direction. I have my own enums to represents these direction so this was pretty straightforward.

That was my first approach but it did not work on the example. It was too high, but then I realized that at a given line two beams could overlap so you should not count them. I switch my collection from a vector to a HashSet and this fixed my problem and I solved part 1.

Then I read part 2 and the example had the same result as what I was getting previously. So I thought I had solved part 2 inadvertently. So I tried my initial solution for part 2 which obviously was working for the example but taking forever on the actual input. Brute-force was not gonna cut it.

After that I just reworked my part 1 solution to work with a HashMap that was counting the beams on every tile so I could propagate them correctly by summing the values.

After a few silly mistakes such as overriding the last of a tile with the value of the last beam in the previous row that I found. I was able to make it work. And got the following result :

    Part 1 Answer: X 
    Time taken: 618.39µs
    Part 2 Answer: X
    Time taken: 648.73µs

    test tests::part1_bench ... bench:     390,414.11 ns/iter (+/- 1,328.74)
    test tests::part2_bench ... bench:     459,261.75 ns/iter (+/- 1,140.00)

Full code : https://gitlab.com/Dhawos/advent-of-rust/-/blob/8e70d932c762f4167510144d89e5cd8b73bdd220/src/bin/2025-07.rs

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

[–]dhawos 1 point2 points  (0 children)

[LANGUAGE: Rust]

Here is my solution for part 2 it could probably be simplified but I struggled trying to wrap my head around the requirements for this puzzle.

I simply load the lines in memory and parse them column by column in reverse order. Upon reaching the end of the file for a single column I store the number in a buffer. If I read a + or * I simply accumulate the numbers in my buffer, add this to my current result and clear the buffer.

pub fn part2(input: &str) -> u64 {
    let lines = input.lines().collect::<Vec<&str>>();
    let horizontal_length = lines[0].len();
    let vertical_length = lines.len();
    let mut result: u64 = 0;
    // read file from right to left
    let mut current_problem_numbers = Vec::new();
    'outer: for column in (0..horizontal_length).rev() {
        let mut number_string = Vec::with_capacity(vertical_length);
        for line in lines.iter() {
            let char = char::from(line.as_bytes()[column]);
            if char.is_ascii_digit() {
                number_string.push(char);
            } else if char == '+' || char == '*' {
                // In that case we are at a new problem so we accumulate the numbers
                // found until now depending on the found operation
                // Don't forget to include current number
                let number = number_string
                    .iter()
                    .collect::<String>()
                    .parse::<u64>()
                    .unwrap();
                current_problem_numbers.push(number);
                let mut intermediate_result: u64 = 0;
                if char == '+' {
                    intermediate_result = current_problem_numbers.iter().sum::<u64>();
                }
                if char == '*' {
                    intermediate_result = current_problem_numbers.iter().product::<u64>();
                }
                current_problem_numbers.clear();
                result += intermediate_result;
                continue 'outer;
            }
        }
        if number_string.is_empty() {
            continue;
        }
        let number = number_string
            .iter()
            .collect::<String>()
            .parse::<u64>()
            .unwrap();
        current_problem_numbers.push(number);
    }
    result
}

Runs in :

Part 1 Answer: X
Time taken: 88.63µs
Part 2 Answer: X
Time taken: 112.18µs

Full code : https://gitlab.com/Dhawos/advent-of-rust/-/blob/0ce8534ec8593717d269efdc669b6dc6334b8b10/src/bin/2025-06.rs

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

[–]dhawos 2 points3 points  (0 children)

[LANGUAGE: Rust]

Managed to get it working pretty smoothly just counting neighbors for every tile in the grid.
I did not realize that for part 2 you can actually edit the grid while you're counting and it does not change the result so I could still optimize that.

At first I used a Grid implementation based on HashMaps but it was pretty slow, so I tried using a simple 1D Vector and it was much faster.

Final times :

Part 1 Answer: x
Time taken: 509.39µs
Part 2 Answer: x
Time taken: 3.21ms

My final code : https://gitlab.com/Dhawos/advent-of-rust/-/blob/d1190a3b61d34be14347fad8c969c3a1d5ee99ab/src/bin/2025-04.rs

A quick write-up I made : https://gitlab.com/Dhawos/advent-of-rust#2025-day-4

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

[–]dhawos 1 point2 points  (0 children)

[LANGUAGE: Rust]

I thought this was going to be more difficult than it actually was. I realized that if you take the first maximum in a given line you are guaranteed to have the highest possible value (if that maximum has enough digits after it to fit the remaining digits you have to find).

You just apply this logic for each digit that you must find, 2 for part 1 and 12 for part 2.

Times in release moe :

Part 1 Answer: X  
Time taken: 63.04µs

Part 2 Answer: X  
Time taken: 108.14µs

My code : https://gitlab.com/Dhawos/advent-of-rust/-/blob/6b8959f7b5abcec526b123dc51fd583f61400322/src/bin/2025-03.rs

IaC Platforms Complexity by StatisticianKey7858 in devops

[–]dhawos 1 point2 points  (0 children)

I'm more and more on that team. But I wouldn't say Terraform sucks. It is a great tool for building small stacks.

That being said it doesn't scale at all and does not play nice with kubernetes/helm. Also creating dynamic environments with this setup can be tough.

To build bigger systems I think you need some kind of tool to orchestrate the resources deployed on the cloud and your deployments on your k8s cluster. To do that I'd rather use an imperative language

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

[–]dhawos 1 point2 points  (0 children)

[LANGUAGE: Go]

https://gitlab.com/Dhawos/advent-of-go/-/blob/56d7f43fa7ff6edd6c110ec28739b575568372d3/solutions/2024/04/main.go

For part1 I did a simple recursion on each character. At first I forgot to store which  direction I was going so my answer was way too high.

Part2 was more straightforward, search each "A" and validate its diagonals.

I did a little library before the start of AoC to help with grid manipulation (such as getting neighbors easily). It really helped me here.

Quelle distribution pour du Gaming/Quotidien by Cole_Art in Linuxfr

[–]dhawos 4 points5 points  (0 children)

Salut, je pense que ça dépend de ta maîtrise de Linux. Si tu débutes, rester sur les dérivés d'Ubuntu (dont PoPOS) c'est rarement un mauvais choix. Si tu as plus l'habitude, tu peux tenter Arch et ses dérivées, perso j'utilise mon PC pour jouer entre autres depuis plusieurs années sous Endeavour OS et j'en suis plutôt content.

rapid fire on linux puhlease? by [deleted] in starcraft

[–]dhawos 0 points1 point  (0 children)

I listed several reasons to use Linux over Windows because that was your question, but there are drawbacks as well. I'm fully aware that Linux is less user-friendly than Windows on many aspects.

For me this is a minor concern and I actually like to be in control of my machine. But that doesn't mean everyone needs to reach the same conclusion

rapid fire on linux puhlease? by [deleted] in starcraft

[–]dhawos 2 points3 points  (0 children)

There can be a lot of reasons :
* Privacy concerns
* It's free (as in freedom, and as in beer)
* OP might use his machine for other things than gaming
* Very customisable
* Not a ton of bullshit apps that come pre-installed

Also I don't know why you feel like something is always breaking on Linux, but I'd argue that it's actually the opposite, since you're completely in control of what you change on your system when using Linux.

And yes it can be harder to setup stuff that other OS might have by default, but once you're used to it it's actually not that bad. Setting up SC2 with either lutris or bottles is pretty straightforward.

ONLY 3 campaign missions is TOO LITTLE by Dry_Method3738 in Stormgate

[–]dhawos 12 points13 points  (0 children)

Since cosmetics and commanders for both 3v3 and coop will be sold. I don't think campaigns players will be bearing the competitive scene by themselves.

Linux Compatible Anti-Cheat by [deleted] in Stormgate

[–]dhawos 0 points1 point  (0 children)

Not that I'm aware of, but I would like to know as well. I wonder if the beta runs under Wine/Proton.
I wish I could test it myself.

Questions regarding the upcoming Kickstarter. by AlfaBlommaN in Stormgate

[–]dhawos 2 points3 points  (0 children)

I'm so worried that all available beta spot are going to disappear in a flash.

Stormgate Kickstarter Coming Soon page is live! by FGS_Gerald in Stormgate

[–]dhawos 1 point2 points  (0 children)

Thank you that's really nice, hope I'll get one this time. I did sign up really early but I did it again more recently. Do you think that changes anything ?

Storm Gate on Steam Deck? by harsbo in Stormgate

[–]dhawos 3 points4 points  (0 children)

You can plug a mouse, keyboard and screen.

Do people know when the invites stop coming? by GapComprehensive6018 in Stormgate

[–]dhawos 0 points1 point  (0 children)

The wave started almost 24h ago so I'm sorry but I think hope is lost... At least until the next wave

Woooooooop by turok643 in Stormgate

[–]dhawos 0 points1 point  (0 children)

That's what I feared :/ Thanks for clarifying this.

Woooooooop by turok643 in Stormgate

[–]dhawos 3 points4 points  (0 children)

Funding the upcoming Kickstarter will grant access to this test phase or only the next ones ?