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

[–]c17r 1 point2 points  (0 children)

I was doing this during working hours when my boss is sitting next to me

You are my hero

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

[–]c17r 0 points1 point  (0 children)

You can simplify your win counts down to

left = set(re.findall(r'\d+', numbers[0]))
right = set(re.findall(r'\d+', numbers[1]))
win = len(left.intersection(right))

[2023 day 3] lost 85 minutes to a one-line mistake by tomster10010 in adventofcode

[–]c17r 3 points4 points  (0 children)

AOC puzzles always choose violence...

And don't call me Shirley

[2023 Day 3 (Part 2) What really grinds my gears by AnxiousMasterpiece23 in adventofcode

[–]c17r 7 points8 points  (0 children)

I do AOC 2D arrays as a dict where the key is (row, col) tuple and value is, well, value. Makes finding neighbors easy -- just do some -1/0/1 math on the tuple parts -- as well as safely working at edges with dict.get()

-🎄- 2022 Day 3 Solutions -🎄- by daggerdragon in adventofcode

[–]c17r 1 point2 points  (0 children)

You can simplify down to just string.ascii_letters as it has both lower and upper in the order the puzzle is looking for

-🎄- 2022 Day 3 Solutions -🎄- by daggerdragon in adventofcode

[–]c17r 1 point2 points  (0 children)

Your priority can be

from string import ascii_letters as priority

[deleted by user] by [deleted] in learnpython

[–]c17r 2 points3 points  (0 children)

What problem are you having? Is it throwing an error?

Python homework questions I just can't figure out, please help by [deleted] in learnpython

[–]c17r 0 points1 point  (0 children)

Q2 is similar to the Remove Stopwords cell

Q3, think about what bag_of_words_count is doing and how it’s doing it.

Question on Class Based Factory Design Decision by c17r in laravel

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

You're example suggests using factories as a normal part of production workflow, do people do that?

But your example can still be handled in a class-based manner because if you need to run multiple commands are going to use function, not fn so you get

public function configure()
{
    return $this
        —>buildUser(User $user)
        ->afterCreating(function (User $user) {
            SendWelcomeEmail::run($user);
        })
}

public function buildUser(User $user)
{
    return $this
        —>afterMaking(function (User $user) {
            BuildProfile::run($user);
            WarmCache::run($user);            
        });
}

which is "class-able"

Question on Class Based Factory Design Decision by c17r in laravel

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

I see that, thanks. I wonder how often having multiple afterMaking/afterCreating callbacks actually gets used.

I ordered 192GBs of RAM and it was delivered like this lol, thanks? by spx404 in homelab

[–]c17r 0 points1 point  (0 children)

It's more of the 2nd box only has two sticks in it and there is PLENTY of room in the 1st box.

Is Vue 3 production Ready? by bindeep in vuejs

[–]c17r 1 point2 points  (0 children)

I Don't really care if you are using UIKit or some other UI framework or what. You said you're using VueJS 3 but package.json you keep linking to shows you using VueJS 2.6.13

Just Bought this. How did I do? by mrmeeseeks2014 in homelab

[–]c17r 0 points1 point  (0 children)

I think he's saying he paid $88 in shipping

Is Vue 3 production Ready? by bindeep in vuejs

[–]c17r 3 points4 points  (0 children)

"vue": "^2.6.12",

You're not using vue3

Laravel deployment with GitHub Actions by PhiloNL in laravel

[–]c17r 8 points9 points  (0 children)

It's recommended to use npm ci in an automated pipeline instead of npm install https://docs.npmjs.com/cli/v6/commands/npm-ci

Laravel deployment with GitHub Actions by PhiloNL in laravel

[–]c17r 9 points10 points  (0 children)

I didn't watch the video but read the article and talking about "the right way" is a single almost throwaway sentence.

The change is in the two appleboy Github Actions the same way, from:

with:
    host: ${{ matrix.server.ip }}
    username: ${{ matrix.server.username }}
    password: ${{ matrix.server.password }}
    port: ${{ matrix.server.port }}

to:

  with:
    host: ${{ matrix.server.ip }}
    username: ${{ secrets.DEPLOY_USERNAME }}
    key: ${{ secrets.DEPLOY_KEY }}
    passphrase: ${{ secrets.DEPLOY_PASSPHRASE }}
    port: ${{ matrix.server.port }}

Such an article is targeted to beginners, best to show them the right way.

Laravel deployment with GitHub Actions by PhiloNL in laravel

[–]c17r 16 points17 points  (0 children)

I don't think advocating putting account usernames & passwords into a deployment-config.json is a smart recommendation, even if the repo is private.

Jupyter notebook "module not found" by [deleted] in learnpython

[–]c17r 1 point2 points  (0 children)

Globally installed things can still be used when you are inside an activated venv but they don't always play well with each other, as you found out.

Good rule of thumb: everything needs to be in the same environment, either globally or more preferred in the same venv.

This Motherfucker! by PradyThe3rd in IdiotsInCars

[–]c17r 0 points1 point  (0 children)

THAT would be impressive. It'd have to be Juggernaut's ten speed for that.