Zikeji

joined 2 years ago
[–] Zikeji@programming.dev 9 points 2 weeks ago

I was looking at building a new PC but I can't stomach paying 5x the price for RAM. I'll just have to wait it out. Though if the price of components other than RAM lower I might consider buying up parts, I'll just have to watch.

[–] Zikeji@programming.dev 21 points 2 weeks ago (1 children)

When I was 15 or so I was hired from an ad on Craigslist for photo editing - just basic touching up, but like a thousand or so photos. The caveat was - softcore porn. I didn't mind, money is money. My very Christian family who found out however - they did mind. My sister ended up finishing the editing for me.

[–] Zikeji@programming.dev 3 points 3 weeks ago

I new product he helped release. So the former.

[–] Zikeji@programming.dev 16 points 3 weeks ago (2 children)

My former coworker left to work at Flock in their R&D department and every time I see Flock popup I check his LinkedIn to see if he's still there and hyup. I didn't take him for the type, but I mean as recently as a month ago he was praising them.

[–] Zikeji@programming.dev 2 points 3 weeks ago* (last edited 3 weeks ago)

If the title is interesting I'll read the text and if I decide to reply there's a good chance I'll sigh and discard my comment and move on.

Although sometimes I won't notice a post with an image has text underneath.

[–] Zikeji@programming.dev 5 points 1 month ago* (last edited 1 month ago)

My thoughts exactly. I thought maybe the ghost was along for the ride so.tbe human was "the vehicle & driver" but frame 1 makes it pretty clear that isn't the case.

One other possibility is the ghost is viewing the rating the human left but that's a stretch lol

[–] Zikeji@programming.dev 18 points 1 month ago* (last edited 1 month ago) (6 children)

It's also more distinct. CP has many potential definitions. CSAM only has the one I'm aware of.

[–] Zikeji@programming.dev 5 points 1 month ago (1 children)

Javascript

I generally like trying the brute force approach first (though in the latter days it just wastes time). After exhausting 32GB of RAM I changed approaches.

Admittedly I don't really understand these algorithms as well as I would like, and I also will admit I inadvertently was LLM assisted :(. When I was trying to figure out what algo I should use and the AI summary in Google's search spoiled me. But I did learn alot.

One interesting observation, unrelated to the solution itself, is the solutions runs about 30% faster in Firefox than it does via Node (25.2.1 and 24.11.1) on my machine.

Code

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

/** @type {Array<[number, number]} */
const points = input.split("\n").map(r => r.split(',').map(v => parseInt(v, 10)));

let largest = 0;
let largestInside = 0;
for (const [startX, startY] of points) {
    for (const [nextX, nextY] of points) {
        if (startX === nextX && startY === nextY) continue;

        const minX = Math.min(startX, nextX);
        const maxX = Math.max(startX, nextX);
        const minY = Math.min(startY, nextY);
        const maxY = Math.max(startY, nextY);

        const area = (maxX - minX + 1) * (maxY - minY + 1);
        if (area > largest) {
            largest = area;
        }

        if (area <= largestInside) continue;

        // center point check, ala https://en.wikipedia.org/wiki/Even%E2%80%93odd_rule
        const centerX = (minX + maxX) / 2;
        const centerY = (minY + maxY) / 2;
        let inside = false;
        for (const [i, [aX, aY]] of points.entries()) {
            const [bX, bY] = points[i - 1] ?? points[points.length - 1];
            if (centerX === aX && centerY === aY) {
                inside = true;
                break;
            }
            if ((aY > centerY) !== (bY > centerY)) {
                const slope = (centerX - aX) * (bY - aY) - (bX - aX) * (centerY - aY);
                if (slope === 0) {
                    inside = true;
                    break;
                }
                if ((slope < 0) !== (bY < aY)) {
                    inside = !inside;
                }
            }
        }

        if (!inside) continue;

        // check for edge intersections, ala https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection
        let intersects = false;
        for (const [i, [aX, aY]] of points.entries()) {
            const [bX, bY] = points[i - 1] ?? points[points.length - 1];

            if (aX === bX) {
                if (aX > minX && aX < maxX) {
                    const wallMinY = Math.min(aY, bY);
                    const wallMaxY = Math.max(aY, bY);

                    if (Math.max(minY, wallMinY) < Math.min(maxY, wallMaxY)) {
                        intersects = true;
                        break;
                    }
                }
            } else if (aY === bY) {
                if (aY > minY && aY < maxY) {
                    const wallMinX = Math.min(aX, bX);
                    const wallMaxX = Math.max(aX, bX);

                    if (Math.max(minX, wallMinX) < Math.min(maxX, wallMaxX)) {
                        intersects = true;
                        break;
                    }
                }
            }
        }

        if (intersects) continue;

        if (area > largestInside) {
            largestInside = area;
        }
    }
}

console.log(`Part 1 Answer: ${largest}`);
console.log(`Part 2 Answer: ${largestInside}`);

[–] Zikeji@programming.dev 2 points 1 month ago

I know if I were to setup the V2L feature on my car to power my home it would look like this (the manual way). But there would be a physical interlock that prevents mains power from being on while this is plugged in.

[–] Zikeji@programming.dev 9 points 1 month ago (2 children)

That file is for debugging. Seems like something is setting SSLKEYLOGFILE. You could try unsetting it (unset SSLKEYLOGFILE). Something is probably setting it in your shell, so you probably want to look at your specific shell configs for a more permanent solution.

[–] Zikeji@programming.dev 87 points 1 month ago (7 children)

Cookie consent dialogs can fuck off and die in general. Always using dark patterns to try and trick you into choosing the worst option.

[–] Zikeji@programming.dev 28 points 1 month ago

There are quite a few EVs that come with simple controls (respectively). It's just the companies spawned to make EVs that decide to reinvent the wheel.

I've had a Chevy Bolt EUV and a Hyundai Ioniq 5 - both have physical buttons for most of what I want.

view more: ‹ prev next ›