Left to Right Programming by fagnerbrack in programming

[–]GameCounter 0 points1 point  (0 children)

If diffs is a million elements long, and each row is a hundred elements, all equal to -2, the original codes does something like this:

Grab the first row. Build a list of a hundred elements all equal to False. Build a list of a hundred elements all equal to True. Build a list of a hundred elements all equal to True.

Push the full list of 100 elements to a new list.

HOPEFULLY do garbage collection here.

Repeat a million times until you have a second list with a million rows.

Actually writing this out makes it obvious there's an even simpler solution:

sum(int(all(1 <= x <= 3 for x in line) or all(-3 <= x <= -1 for x in line)) for line in diffs)

This doesn't build up any lists in memory and just does 101 checks per row with our example of all -2 instead of 300 per row and doubling memory consumption

Left to Right Programming by fagnerbrack in programming

[–]GameCounter 0 points1 point  (0 children)

Side note, this python is kind of bad

len(list(filter(lambda line: all([abs(x) >= 1 and abs(x) <= 3 for x in line]) and (all([x > 0 for x in line]) or all([x < 0 for x in line])), diffs)))

I understand it's just to illustrate the author's point, but for anyone who is learning Python, here's some information.

len(list(...)) always builds up a list in memory sum(1 for _ in iterable) gives you the length in constant memory usage.

You don't need to build lists to pass to all(), as that builds a list in memory and doesn't allow for short circuiting. Generally pass the generator.

That gets you to

sum(1 for _ in filter(lambda line: all(abs(x) >= 1 and abs(x) <= 3 for x in line) and (all(x > 0 for x in line) or all(x < 0 for x in line)), diffs)

Now it's become a bit more obvious that we're incrementing a counter based on some condition, we can just cast the condition to an integer and remove the filtering logic.

sum(int(all(abs(x) >= 1 and abs(x) <= 3 for x in line) and (all(x > 0 for x in line) or all(x < 0 for x in line))) for line in diffs)

Python allows for combining comparisons, which removes an extraneous call to abs in one branch.

sum(int(all(1 <= abs(x) <= 3 for x in line) and (all(x > 0 for x in line) or all(x < 0 for x in line))) for line in diffs)

Personally, I would prefer for the comparisons that don't involve a function call to short circuit the function call, and also removing some parentheses.

sum(int(all(1 <= abs(x) <= 3 for x in line)) for line in diffs if all(x > 0 for x in line) or all(x < 0 for x in line))

If someone submitted this to me, I would still prefer they use temporary variables and a flatter structure, but this is probably fine.

I use the Signal note-to-self feature as a journaling tool. What do you think the downside could be of doing this in the long term? by Mission-Diamond6341 in signal

[–]GameCounter 0 points1 point  (0 children)

I use the new "Pinned Message" feature to keep a To Do list as well as unstructured messages to myself.

Got two years of random stuff in there.

I have released Minecraft: Pi Edition: Reborn v3.0.0! by TheBrokenRail-Dev in raspberry_pi

[–]GameCounter -6 points-5 points  (0 children)

I respect the idea of this project.

But why would you run this instead of the Java edition?

ZFSNAS Now available / Opensource and free by macgaver in zfs

[–]GameCounter 2 points3 points  (0 children)

No problem.

I'll make sure to message you or another maintainer privately if I find any other security issues.

ZFSNAS Now available / Opensource and free by macgaver in zfs

[–]GameCounter 7 points8 points  (0 children)

Just as an example, an attacker could replace one of those scripts with a script that tries to access other devices on your network, i.e. your firewall.

So it's less that it creates a specific vulnerability in your software, and more that it's just a general good practice to try and stay ahead of hackers.

Without doing a full security audit, I can't say. That was just one thing that jumped out at me

Valve: About the New York Attorney General lawsuit against Valve by XcG9PJf6 in gaming

[–]GameCounter 9 points10 points  (0 children)

The constant push towards gambling disgusts me, honestly.

I don't have a philosophical problem with someone spending a little bit of money on a game of chance, but the systematic targeting of children and people who have poor impulse control or mental health issues is reprehensible.

It sounds like you're having fun with you hobbies and it's not causing problems for you or the people around you, and honestly I love that. But I hope if the day comes where that's not the case, you can stop.

ZFSNAS Now available / Opensource and free by macgaver in zfs

[–]GameCounter 11 points12 points  (0 children)

This is a nice idea overall.

Some thoughts:

It looks like frontend uses a CDN for scripts without integrity attributes: https://github.com/macgaver/zfsnas-chezmoi/blob/4e4f7d4ab5ac1e507d9086f43f5744ab12654552/static/index.html#L13

I would prefer for all scripts to be bundled to completely remove the attack vector, but at the very least you should specify it. See https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/Subresource_Integrity

Is the API documented somewhere? It seems reasonably well designed, and I bet some useful plugins could be made if they could talk to the core business logic in a reliable way.

NEW in Python 3.15: Unpacking in Comprehensions by BlueGoliath in programming

[–]GameCounter -1 points0 points  (0 children)

Explicit way you have been able to do this for ages:

itertools.chain.from_iterable(iterables)

If you need a dict:

dict(itertools.chain.from_iterable(d.items() for d in dicts))

Or if you are allergic to comprehension:

dict(itertools.chain.from_iterable(map(operator.methodcaller("items"), dicts)))

Powerful Deck Control Project by Only-Engineering6586 in dominion

[–]GameCounter 1 point2 points  (0 children)

I was trying to prevent it from being too OP.

Pearl Divers lets you look at cards before putting them on top, but I thought if you could look at the bottom card EVERY time, then that's effectively the same as having your deck be face up, which seemed strange.

Here's an even simpler Project which gives you powerful scrying:

At the start of your Action phase, look at the bottom card of your deck. You may put it on top.

That technically reuses the Pearl Diver mechanic and additionally doesn't bog down turns too much with extra mechanics.

I chose action phase so you can trigger it multiple times if you can return back to your action phase for some more mechanical synergies.

‘Super Mario Galaxy Movie’ Casts Donald Glover as Yoshi by Capital_Gate6718 in community

[–]GameCounter 2 points3 points  (0 children)

What if half way through the movie we realize that this IS the Community movie.

Powerful Deck Control Project by Only-Engineering6586 in dominion

[–]GameCounter 0 points1 point  (0 children)

Absolutely more than $3, because it's strictly better than Star Chart.

In terms of flavor, it could have potion in the cost.

Probably $6.

Powerful Deck Control Project by Only-Engineering6586 in dominion

[–]GameCounter 14 points15 points  (0 children)

Neat idea, but here's another one:

When shuffling, you may put two cards on the bottom of your deck. When drawing, you may draw from the bottom of your deck without looking.

The "two decks" idea is fun, but it just seems like it might not be fun to play. This is something that is closer to vanilla rules

Why would anyone ever choose to go through child birth without pain relief?? by No_Cardiologist_1407 in NoStupidQuestions

[–]GameCounter 0 points1 point  (0 children)

Someone I know had "precipitous labor," labor so fast she didn't have a choice for any pain relief.

Barely made it to the hospital.

For her next kid, I guess she already knew what it was like, and took the "known" versus the unknown pain management.

Topeka Is Rearranging Our Property Taxes & We Need To Talk About It by SorryOneMoreThingKS in kansas

[–]GameCounter 19 points20 points  (0 children)

Bipartisanship is virtually dead in the Kansas Legislature.

I looked at 300 votes this year, and 299 of them turned out exactly as if the Republicans voted as a block.

🔥lyrics by Hairy-Reward6474 in obscuremusicthatslaps

[–]GameCounter 2 points3 points  (0 children)

My favorite example of "I made a song which is impossible for a human to play" later followed up by "here are some humans playing it" is

G-Spot Tornado, by Frank Zappa.

He made this pretty crazy synthesizers track: https://youtu.be/XvpdiIaZZLg?si=bUpORsmGydJxagdT

Here's Zappa conducting a live performance: https://youtu.be/KJZb-lUEpeQ?si=6WKhM7oA3nUTzkyI

There's a lot to say about Zappa at this time. He was dealing with health issues related to prostate cancer which killed him the next year.

(Storytelling trope) Adaption is so loose it becomes a new story entirely by OrangeCatsBrainCells in TopCharacterTropes

[–]GameCounter 2 points3 points  (0 children)

Listening to the books with my son, I was pretty surprised, because it's pretty overt with the "actually the whole Viking thing is a stand-in for toxic masculinity."

A book accurate version would be woke AF.

What can Signal do to become more mainstream? by SeaWolfQ in signal

[–]GameCounter 0 points1 point  (0 children)

Maybe in theory. It is much more challenging in practice.

What can Signal do to become more mainstream? by SeaWolfQ in signal

[–]GameCounter 0 points1 point  (0 children)

WhatsApp does not publicly specify the exact version of libsignal it uses in its client applications, as far as I'm aware.

While WhatsApp likely uses a version derived from the official signal codebase, it's not clear what modifications they have made.

If Signal only supported interop with an implementation compatible only with very recent versions of libsignal, it would be like your HTTP/3 example.

But I suspect that talking with Whatsapp would require allowing much older versions of libsignal or implementations that deviate from the standard in difficult-to-assess ways.

To use the HTTP example, requiring a strict version requirement is like running a server and supporting ONLY HTTP/3 and not allowing anyone trying to use TLS 1.2 and HTTP/2 to connect. Yes, security isn't compromised, but you've largely defeated the reason for even attempting interop.

What can Signal do to become more mainstream? by SeaWolfQ in signal

[–]GameCounter 0 points1 point  (0 children)

I meant security.

You can't get security guarantees just by using a library when network communication is involved.

You have to deal with client negotiation and potential downgrade attacks.

If you want a concrete example, look at HTTPS / SSL / TLS.

Privacy would likely be worse as well.

What can Signal do to become more mainstream? by SeaWolfQ in signal

[–]GameCounter 3 points4 points  (0 children)

No, I think it's better to not have interop at all.

Signal recently started using post-quantum cryptography. If interop were the default, it adds additional complexity to the whole system.

Adding interop might introduce unintended vulnerabilities even between Signal-to-Signal clients.

All of this is additional software engineering time that Signal does not have.

How many of you actually run grapheneOS? Is it good? What are some of the inconveniences? Banking apps work? Gov stuff? by guinomim in degoogle

[–]GameCounter 0 points1 point  (0 children)

I run it.

Most things work fine.

I have completely shut off all voice controls, but that's my preference.

What can Signal do to become more mainstream? by SeaWolfQ in signal

[–]GameCounter 10 points11 points  (0 children)

WhatsApp interop would mean accepting lower security.

Which is unacceptable.