User's banner
Avatar

JRaccoon

JRaccoon@discuss.tchncs.de
Joined
0 posts • 4 comments

Howdy! đź‘‹

I’m level 27 web dev from 🇫🇮 Finland. Full stack developer by trade but more into server side and sysadmin stuff.

A furry or something. Why be yourself when you can be fluffy raccoon on the internet?

I’m also on Mastodon: @jakeRaccoon@mastodon.social

Direct message

I’ve been working through my backlog on Steam

I finished Twin Mirror last night and today I started Kona II. I’m couple of hours in and so far it’s been a little meh. Graphics are great and all but it just doesn’t have the same atmosphere than the first Kona had

permalink
report
reply

Cool, thanks for the explanation.

a single application that gets bundled with all necessary dependencies including versioning

Does that mean that if I were to install Application A and Application B that both have dependency to package C version 1.2.3 I then would have package C (and all of its possible sub dependencies) twice on my disk? I don’t know how much external dependencies applications on Linux usually have but doesn’t that have the potential to waste huge amounts of disk space?

permalink
report
parent
reply

Sorry to ask, I’m not really familiar with Linux desktop nowadays: I’ve seen Flatpak and Flathub talked about a lot lately and it seems to be kinda a controversial topic. Anyone wanna fill me in what’s all the noice about? It’s some kind of cross-distro “app store” thingy?

permalink
report
reply

TypeScript

GitHub link

It’s nice to have a quick easy one for a change

Code
import fs from "fs";

const rows = fs.readFileSync("./09/input.txt", "utf-8")
    .split(/[\r\n]+/)
    .map(row => row.trim())
    .filter(Boolean)
    .map(row => row.split(/\s+/).map(number => parseInt(number)));

console.info("Part 1: " + solve(structuredClone(rows)));
console.info("Part 2: " + solve(structuredClone(rows), true));

function solve(rows: number[][], part2 = false): number {
    let total = 0;
    for (const row of rows) {
        const sequences: number[][] = [row];
        while (sequences[sequences.length - 1].some(number => number !== 0)) { // Loop until all are zero
            const lastSequence = sequences[sequences.length - 1];
            const newSequence: number[] = [];
            for (let i = 0; i < lastSequence.length; i++) {
                if (lastSequence[i + 1] !== undefined) {
                    newSequence.push(lastSequence[i + 1] - lastSequence[i]);
                }
            }
            sequences.push(newSequence);
        }

        // For part two just reverse the sequences
        if (part2) {
            sequences.forEach(sequence => sequence.reverse());
        }

        // Add the first zero manually and loop the rest
        sequences[sequences.length - 1].push(0);
        for (let i = sequences.length - 2; i >= 0; i--) {
            sequences[i].push(part2
                ? sequences[i][sequences[i].length - 1] - sequences[i + 1][sequences[i + 1].length - 1]
                : sequences[i][sequences[i].length - 1] + sequences[i + 1][sequences[i + 1].length - 1]
            );
        }
    
        total += sequences[0].reverse()[0];
    }

    return total;
}
permalink
report
reply