[โ€“] 5 points 11 months ago (1 child)

A straightforward day 1 for a Javascript / NodeJS solution.

Poorly Optimized JS Solution

let position = 50;
let answer1 = 0;
let answer2 = 0;

const sequence = require('fs').readFileSync('input-day1.txt', 'utf-8');

sequence.split('\n').forEach(instruction => {
    const turn = instruction.charAt(0);
    let distance = parseInt(instruction.slice(1), 10);

    while (distance > 0) {
        distance -= 1;

        if (turn === 'L') {
            position -= 1;
        } else if (turn === 'R') {
            position += 1;
        }

        if (position >= 100) {
            position -= 100;
        } else if (position < 0) {
            position += 100;
        }

        if (position === 0) {
            answer2 += 1;
        }
    }

    if (position === 0) {
        answer1 += 1;
    }
});

console.log(`Part 1 Answer: ${answer1}`);
console.log(`Part 2 Answer: ${answer2}`);

  • source
  • [โ€“] 12 points 11 months ago (1 child)

    Does not appear to be the correct MR. Comments on the issue allude to "they never pushed it" so sounds like there never was an MR. Watching the announcement where they demo'd it, it wrote much more than is in that MR. Not to defend OpenAI, I hate vibe coded solutions that add so many useless comments.

    Write. Readable. Code.

  • source
  • parent
  • context
  • [โ€“] 25 points 1 year ago* (last edited 1 year ago)

    I agree, rhetoric like OP's framing a non-FOSS distro as 'just another closed source/black boxed OS' reads like OP is suggesting it isn't even worth migrating from Windows to say, Bazzite. Which is dangerous.

    I'll take a door I can peer into but has a few shadows over a completely closed door anyday.

  • source
  • parent
  • context
  • [โ€“] 3 points 1 year ago (1 child)

    Well, it can't hurt to cross it off. You don't need to get a domain from a registrar that offers dynamic DNS, you just need to register a domain (or try another dynamic DNS like the other user suggested) and use a DNS provider that is free and offers an API. I personally use Cloudflare, there are plenty of guides for setting up a dynamic record on CF.

    For registering a domain you can use an affordable registrar, I'm a Porkbun customer - for a .com domain it's like $11 for a year. No need to spend monthly.

  • source
  • parent
  • context
  • [โ€“] 6 points 1 year ago (9 children)

    Let's back up some - a free dynDNS provider would not cause connection issues, unless DNS resolution itself stopped working - which is unlikely. It sounds more like the Internet you're running off of itself has issues. What in particular is making you blame the dynDNS? Who is it?

  • source
  • view more: โ€น prev next โ€บ