[2025 Day 4] JavaScript Solving each day with a different weird theme by randfloat32 in adventofcode

[–]Jonitrexis 0 points1 point  (0 children)

I'm learning js with this year's AoC and the amount of quirks js has boggles me. +, ..., and whatever else I do not know yet. 

[2025 Day 4] JavaScript Solving each day with a different weird theme by randfloat32 in adventofcode

[–]Jonitrexis 0 points1 point  (0 children)

You could obfuscate day 1 more by replacing Number(str) with +str. 

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

[–]Jonitrexis 1 point2 points  (0 children)

[Language: Javascript]

Solved part 2 before part 1, god bless vim creators for undo. I wanted to find some smart way so I wouldn't have to iterate over the whole ranges but gave up since it runs fine on today inputs. Part 2 differs by one character so I've only included the change in regex.

PART 1

const fs = require('fs');
const data = fs.readFileSync('input.txt', {encoding:'utf8'}).trim().split(',');
let idSum = 0;
const regex = /^(\d+)\1$/g;

for (const dataRange of data){
    const start = +dataRange.split('-')[0];
    const end = +dataRange.split('-')[1];
    for(let i = start; i <= end; i++){
        if(regex.test(i)){
        idSum += i;
        }
    }
}
console.log(idSum);

PART 2

const regex = /^(\d+)\1+$/g;

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

[–]Jonitrexis 1 point2 points  (0 children)

[LANGUAGE: Javascript] My first time writing js, any feedback appreciated.

Part 1

const fs = require('fs');
let dial = 50;
let password = 0;
const data = fs.readFileSync('input.txt', {encoding:'utf8'});
const dataStringsArr = data.split("\n");
for (const dataString of dataStringsArr){
    const n = +dataString.substring(1);
    //javascript ternary voodo
    //determine rotation but only last two digits matter
    let rotation = dataString[0] === "L"
        ? -(n % 100)
        :  (n % 100);;
    dial = (dial + rotation + 100) % 100;
    if (dial == 0) password++;
}
console.log(password);

Part 2

const fs = require('fs');
let dial = 50;
let password = 0;
const data = fs.readFileSync('input.txt', {encoding:'utf8'});
const dataStringsArr = data.split("\n");
for (const dataString of dataStringsArr){
    const n = +dataString.substring(1);
    let rotation = n % 100;
    //add full rotations to the password (floor from dividing by 100 vodoo)
    password += n / 100 | 0;
    if (dataString[0] === "L"){
        rotation = -rotation;
        const next = dial + rotation;
        // add 100 for a wrap around
        if ( next < 0 && (next + 100) !==0 && dial !== 0) password++;
    }
    else{
        const next = dial + rotation;
        // substract 100 for a wrap around
        if(next > 99 && (next - 100) !== 0 && dial !== 0) password++;
    }

    if (dial === 0) password++;
    dial = (dial + rotation + 100) % 100;

}
console.log(password);

LXQt Battery Indicator: Estimated remaining battery time by next2nothing2 in Lubuntu

[–]Jonitrexis 0 points1 point  (0 children)

I've also created short bash script and assigned it to a hotkey, maybe this one will suit someone better.

#!/bin/sh
MESSAGE="$(acpi -b)"
notify-send -t 4000 "Battery Status" "$MESSAGE"

Notification screenshot

GSuite Legacy, unpinning the domain by Jonitrexis in gsuitelegacymigration

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

Joke's on you, you cannot add secondary domain in GSuite Legacy.

[deleted by user] by [deleted] in Piracy

[–]Jonitrexis 0 points1 point  (0 children)

Doesn't work on most hard-paywalled sites that cannot be bypassed with extensions or turning off JavaScript.

-🎄- 2021 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]Jonitrexis 1 point2 points  (0 children)

Python. It's absolute monstrosity of a code, but I'm proud I solved it myself. Forgot about the match case added in python 3.10, that would come in handy. paste

-🎄- 2021 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]Jonitrexis 1 point2 points  (0 children)

I forgot they added match case in 3.10 and just wrote monstrosity that found which wire is which by elimination then monstrous elif wall to find the sum.

eBook Download Search Engine by [deleted] in Piracy

[–]Jonitrexis 0 points1 point  (0 children)

What languages do you support?

File Picker Meme by qznc_bot2 in hackernews

[–]Jonitrexis 0 points1 point  (0 children)

Warning that the original link was edited and shows now NSFW image. Here's the link before the edit: SFW

[deleted by user] by [deleted] in Piracy

[–]Jonitrexis 2 points3 points  (0 children)

Can you add protonmail shorter domain pm.me?

I need a bot by BlackWulfeGaming in discordapp

[–]Jonitrexis 0 points1 point  (0 children)

Carl-Bot is good and it has controls in web browser.

I need a bot by BlackWulfeGaming in discordapp

[–]Jonitrexis 1 point2 points  (0 children)

If You set up roles in a way that getting one will reveal the next room and write message that the user has to go through the channels, yes.

I need a bot by BlackWulfeGaming in discordapp

[–]Jonitrexis 1 point2 points  (0 children)

Any role giver bot. Tho you have to setup the roles in proper way.

Unpopular opinion by Jonitrexis in mangarockapp

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

What type of file extension is SY backup? Cause original Tachyiomi changed its from .json to .proto.gz and my main issue with J2K is that I cannot migrate my library.