HNHacker News
TopNewBestAskShowJobs

quuxplusone

1,261 karma · joined February 15, 2024

submissionscomments
quuxplusone··on A more efficient implementation of Shor's algorithm
Top comment on LWN is a very interesting read (although neither the commenter nor myself claim any such trickery was involved in this case).

> Trail of Bits were able to craft an input that beats Google's circuit and prove it... by virtue of a bug in the verifier: https://blog.trailofbits.com/2026/04/17/we-beat-googles-zero... Google patched the vuln and the original proof still stands, but this is a pretty strange path we seem to be walking down [...]

quuxplusone··on Patch applies fake diffs from commit messages
jolmg points out that if you use a GitHub URL ending in .diff instead of .patch, you get something much more suitable to feed mechanically into `patch`. (And probably not so exploitable.)

Therefore I retract my claim that this is even a "misuse" of `git format-patch` by GitHub. Seems like GitHub provides both a git-am-able endpoint and a (less exploitable) patch-able endpoint, and the issue is just that OP chose the less suitable one of those two endpoints.

quuxplusone··on Patch applies fake diffs from commit messages
> fake email headers

That's the output you get from `git format-patch --stdout -1 dd28283`. The idea is that it's suitable for emailing to a mailing list for review (hence the subject line beginning with [PATCH], and so on).

If you ask for colorized output with `git format-patch --color=always --stdout -1 dd28283` you'll see that `git format-patch` itself knows which bits are the commit message and which bits are the diff. (Well, of course it does, I guess.)

I suspect that if you sent a patch like this to the mailing list, they'd get mad at you. So `git format-patch` is working OK for its intended use-case. Arguably it's GitHub causing the problem here by "misusing" `git format-patch` as a way to deliver patches that are (these days) expected to be machine-readable — something you can just curl and pipe into `patch`. `git format-patch` doesn't do that.

That said, yeah, it's amusing that (as TFA says)

    git format-patch -1 HEAD --stdout > 0001 ;
    git checkout HEAD~ ;
    git am 0001
isn't a clean round-trip. `git am` applies the fake diff.

> If you think I can get you to patch inappropriate files by writing a fake diff into my commit message... wait until you see what I can do by writing those same changes into the real diff.

Well put. :)

quuxplusone··on If more than 50% press blue, everyone survives. Red pressers always survive
The framing in terms of colors helps the reader to interpret the thought experiment in terms of "groups" or "teams" — as if there's a "blue team" that you can join by helping, and help by joining. Many readers will quickly [ https://en.wikipedia.org/wiki/Stroop_effect ] intuitively choose to join the blue team, and then rationalize their choice as a strategy to help their blue teammates.

But in fact the thought experiment doesn't say there are teams or groups at all! The reader imposes that part on their own, unconsciously at first, because of the description's emphasis on colors.

I predict that running the same Twitter poll with flipped colors — so that red means "I die, unless a majority of my fellows pick red" and blue means "I survive no matter what" — would yield a majority for blue too. What was previously justified as the "virtuous" choice (blue) would now be justified as the "only intelligent" choice (blue).

quuxplusone··on Casus Belli Engineering
"Scapegoat-Driven Development" is right there! It would have fit OP's message better, too, in that the thing he's complaining about is maybe not worthy of the name "engineering" but is unquestionably some kind of "development."

But "waterfall" and "Agile" are such soft targets. I'd rather have seen a blog post with real war stories about real components/idioms/files/libraries from real codebases, not just another "methodologies" piece.

And is there an inverse problem, "scapegoat-driven stagnation," where we can't even think about addressing X,Y,Z until we have gotten rid of G (or finish the long-planned but as-yet-unstarted migration off of G)? That is, where G itself doesn't actually block these projects, but everyone uses G as a convenient excuse to postpone them anyway.

quuxplusone··on 1D Chess
> It looks like white wins for n=6 and n=8 with perfect play, otherwise it is a draw.

For n=6 it's "1. N4 mate," right?

For n=7, "1. R5" is a stalemate; "1. R4 N4 2. N4 r4#" is a loss; "1. N4 n4 2. R2 r6 3. R3 r5 ..." is a draw by repetition; so yeah, it's a draw with best play.

quuxplusone··on Tofolli gates are all you need
c is the constant 1. You don't need to store that.

> Furthermore [this doesn't scale].

Precisely.

https://en.wikipedia.org/wiki/Toffoli_gate has better details.

quuxplusone··on 1D Chess
How do you mate with N+K? Surely your King can't give check, and if your Knight is giving check then the enemy king can just take a step toward it to get out of check.
quuxplusone··on 1D Chess
Mentioned in TFA: This version of chess is given by Martin Gardner in his "Mathematical Games" column of July 1980 (pages 27 and 31) — https://www.jstor.org/stable/24966361 — and the analysis of White's mate is given in the column of August 1980 (page 18) — https://www.jstor.org/stable/24966383.

I do wonder how things would change if the board were 9 cells long; 10 cells long; etc. Also, it seems "in the spirit" to permit castling if neither K nor R has moved yet: i.e., from the position

K _ R N r _ n k

White ought to be permitted to

_ R K N r _ n k

(Or maybe there's a stronger argument for R K _ N r _ n k, actually. The former was conceptually "rook moves halfway toward king, then king moves to the other side of rook"; but the latter is "rook moves two steps in king's direction while king moves to the other side of rook.")

I'm pretty sure this wouldn't change the analysis on the 8-cell board at all, though. I wonder if it would change the analysis on any size of board.

quuxplusone··on The curious case of retro demo scene graphics
It checks out: https://archive.org/details/pdfcoffee.com_stan-lee-how-to-dr...
quuxplusone··on The curious case of retro demo scene graphics
> I should own the fruits of my head like I own the fruits of my tree and they should remain property forever.

You're blindly assuming that in owning a thing now, you must naturally own it forever; that you can live forever in an eternal "now," like a child or an animal. But that's not how the natural world works, nor is it how the human world works. Supposing you own a particular tree; if you let the fruit from that tree fall to the ground and rot, you mustn't complain if someone else, picking up that fruit, saves it from rot.

Compare Schopenhauer, "The World as Will and Representation," IV.62:

> Take the case of an object that has been worked on, improved, or guarded and protected from mishap through someone’s efforts, however small, even if they amounted to no more than plucking or picking up some wild fruit from the ground: someone who seizes this object clearly deprives the other of the results of the energy he has expended on it; he is making the other’s body serve his will instead of its own [...] i.e. he is doing wrong. — On the other hand, simply enjoying something without doing any work on it or safeguarding it against destruction gives us as little right to the thing as the declaration of our will to be its sole owner. Thus, when a family has hunted by itself in a district for even a hundred years without having done anything towards its improvement, then this family cannot keep out a newcomer who wants to hunt there too without morally doing wrong. There is absolutely no moral ground for the so-called right of preoccupation, which holds that simply by virtue of having enjoyed a thing you can demand the exclusive right to its further enjoyment as an additional reward. The newcomer would have much more of a right to tell anyone whose claim rests merely on this right (the right of preoccupation): ‘the very fact that you have been enjoying it for so long makes it right that others should enjoy it now.’

Compare also Aesop:

> A Dog asleep in a manger filled with hay, was awakened by the Cattle, which came in tired and hungry from working in the field. But the Dog would not let them get near the manger, and snarled and snapped as if it were filled with the best of meat and bones, all for himself. The Cattle looked at the Dog in disgust. "How selfish he is!" said one. "He cannot eat the hay and yet he will not let us eat it who are so hungry for it!"

quuxplusone··on The Document Foundation ejects its core developers
And, even more importantly, don't post it on April Fools Day! Delay gratification for 24 hours.
quuxplusone··on Unsubscribe from the Church of Graphs
> This guy isn't a liberal

The intro paragraph threw me for a while, too. The author says he stopped liking Scott Alexander's posts because of the tenor of Scott's politics. Usually in the past couple decades when someone's said that it's meant "Scott's too Republican-coded for me on things like race and feminism"; but this post's author is actually arguing that Scott is too Democratic-coded for him on social issues like crime (and, by extension, immigration and race: TFA's author doesn't approve of the number of "obviously illegal" food trucks he sees on the street, for example).

quuxplusone··on C++26 is done: ISO C++ standards meeting Trip Report
The problem with that is that C++26 Contracts are just glorified asserts. They trigger at runtime, not compile time. So if your LLM-generated code would have worked 99% of the time and then crashed in the field... well, now it will work 99% of the time and (if you're lucky) call the contract-violation handler in the field.

Arguably that's better (more predictable misbehavior) than the status quo. But it's not remotely going to fix the problem with LLM-generated code, which is that you can't trust it to behave correctly in the corner cases. Contracts can't make the code magically behave better; all they can do is make it misbehave better.

quuxplusone··on App that shows real-time lightning on Earth is showing bombings in Middle East
This headline seems editorialized, given that the URL just goes to maps.blitzortung.org, which makes no such claim (and AFAICT the map shows no unusual activity around Iran as of this particular instant either — maybe it did an hour ago, for all I know).
quuxplusone··on C++26: A User-Friednly assert() macro
When NDEBUG is set, there is no test, no assertion, at all. So yes, this code has UB if you set NDEBUG and then pass it a null pointer — but that's obvious. The code does exactly what it looks like it does; there's no tricks or time travel hiding here.
quuxplusone··on The Comforting Lie of SHA Pinning
TFA writes: "Late last year NPM was basically a skip fire" — is this an idiom I should know? (Something like a misfire?) Or a typo for "ship fire"? Or something else?
quuxplusone··on Can It Resolve DOOM? Game Engine in 2k DNS Records
This is confusing. Is it just an AI summary pasted on top of a copy of the linked original article, https://blog.rice.is/post/doom-over-dns/ ? And is that a rehash/explainer of the Github repo posted yesterday, https://github.com/resumex/doom-over-dns — or is it something new?
quuxplusone··on Delve – Fake Compliance as a Service
This article could be massively improved by saying somewhere in the first 10,000 words what Delve is, or at least what it does. From the name I'm guessing something to do with LLMs?
quuxplusone··on Iowa Payphone Defends Itself (Associated Press, 1984)
I believe it. People born after the payphone era might not realize that the telephone cord in this case wouldn't be the cushy plastic home-telephone cord such as you can find by googling "strangled with telephone cord," but rather a "payphone armored cord", which looks almost like a "metal-clad electrical cable" except more flexible and stretchy (such that you conceivably could get a nasty pinch from it when it contracted again).

Also, while I believe a payphone-cord pinch could draw blood, I don't believe any hospital staffer could mistake an actual stabbing wound for such a pinch. So the guy couldn't have actually gotten stabbed. Although I guess he could have been covering up for the drunk friend who dared him to pinch his neck in a payphone cord...

quuxplusone··on Iowa Payphone Defends Itself (Associated Press, 1984)
What an ad-infested website.

The full AP story from 1984 (including the last two sentences, which were snipped off of the clipping in TFA for some reason) is available in a few places, e.g. in the Lake City Reporter of 1984-10-31, under the headline "Fight With Phone Lost":

https://newspapers.uflib.ufl.edu/UF00028308/08196/zoom/18

quuxplusone··on RFC 454545 – Human Em Dash Standard
Yeah; if it's already March, why NOT wait for the traditional joke-RFC day? (But I say this who shouldn't: I've several times thought "I'll post this on such-and-such day," and then when the day came, forgotten to post it. So maybe it's "better early than never"?)
quuxplusone··on Artificial-life: A simple (300 lines of code) reproduction of Computational Life
Yesterday I played around with the repo and found that (IIUC) one "environmental condition" already present in the simulation is the mutation rate. With relatively low mutation rates, I find that a whole tape filled with `<` is a good "substrate," in the sense that it can sit there stably for a long time until a random mutation puts `,` into one of its cells. Within a few generations, it will have spattered copies of the substrate into all its neighbors. Then they sit until a random mutation puts `,` into one of their cells... and so on.

I described what (I think) I'm seeing in https://github.com/Rabrg/artificial-life/pull/1 , and suggested in https://github.com/Rabrg/artificial-life/pull/3 that random mutations ought to blow away the whole tape rather than modify only one cell of it. However, even with that modification to the rules, I still see the `<` substrate taking over the whole map, except when the mutation rate is very high. (I admit this doesn't make a ton of sense to me.)

So, anyway, it's easy to make the mutation rate vary from one side of the map to the other. If you do that right, you can see the `<` substrate take over the low-mutation-rate side of the map, but fail to take over the higher-mutation-rate side.

The `<` substrate is easy to see in the gif: it's a rapidly spreading splotch of red with gold noise flickering inside.

quuxplusone··on Practical Guide to Bare Metal C++
I wouldn't call the idiom you describe (like with unique_lock's defer_lock_t constructor) "tag dispatch"; to me, one defining characteristic of the "tag dispatch idiom" is that the tag you're dispatching on is computed somehow (e.g. by evaluating iterator_traits<T>::iterator_category()). The idiom you're describing, I'd call simply "a constructor overload set" that happens to use the names of "disambiguation tags" to distinguish semantically different constructors because — as you point out — C++ doesn't permit us to give distinct names to the constructor functions themselves.

For more on disambiguation tags, see https://quuxplusone.github.io/blog/2025/12/03/tag-types/

and https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p39...

quuxplusone··on Artificial-life: A simple (300 lines of code) reproduction of Computational Life
You're probably thinking "one cell = one pixel." In fact "one cell = one 8x8 block of pixels"; the specific pattern of colors in each 8x8 block represents the opcodes of that cell's 64-opcode program. So when the replicator takes over the map, it's changing the image to a repeating pattern of 8x8 blocks.

Now, don't quote me on this part, but I think the first replicator to take over is this (minus all the "junk DNA" between the instructions):

    [}<,]}],<}[
and the second, more efficient, one is:

    {[}<,]],<}[{
The latter means roughly:

    --head1;
    while (*head0) { *--head0 = *++head1; }
    *head0-- = *head1++;
    while (*head0) { --head1;
    // CUT HERE
which gets pasted together with whatever cell it's breeding with at the time.
quuxplusone··on Artificial-life: A simple (300 lines of code) reproduction of Computational Life
Well, (somewhat tongue-in-cheek,) one of the defining characteristics of "good money" is that it is very inefficient to replicate!

(Several places online list "durability; portability; divisibility; scarcity; fungibility; and acceptability" as the key characteristics of "good money." Difficulty-of-replication pertains to the "scarcity" characteristic: if it's easy to duplicate, that makes it "bad" money, not "good" money.)

quuxplusone··on Hidden Overheads (2023)
Experienced programmers can skip to the conclusion, which (after a brief misstep to say that "accessing memory on the stack is, like any other memory access, O(n), depending on how much memory you access") is basically that the defining characteristic of a systems language is that no built-in operation should take more than O(1).

I mean, sort of. Except that obviously there are operations, like sorting, which necessarily take more than O(1). Suppose we had a language exactly like C except that `sort` was a builtin instead of a library function: would that make it less of a good systems language? Or is there something about spelling the operation "sort" that makes it more acceptable?

Is the ultimate criterion just that everything should have "the right" cost for how it's spelled — or in other words, that operations' costs should be predictable by the systems programmer — or in other words, the language shouldn't behave too weirdly given how it looks — or in other words it should look mostly like C, and the parts that look like C should also behave like C? I think that's a pretty decent criterion, actually.

quuxplusone··on To understand our fascination with crystals, researchers gave some to chimps
https://news.ycombinator.com/item?id=47092006

https://news.ycombinator.com/item?id=46843805

https://news.ycombinator.com/item?id=46624740

(I don't fully understand the relationship between archive.is, archive.ph, and archive.today, but my impression is that they're all the same person.)

quuxplusone··on Stop using grey text (2025)
That, plus the line "Or, you could just not do it [change your colors with CSS] in the first place which would look like this:" — followed by a super-duper-CSS-styled box thingie full of gray text.
quuxplusone··on Suspected Insiders predict US attack on Polymarket
Current HN title: "Suspected insiders predict US attack on Polymarket." Should probably read "Polymarket insiders predict (or: trade in front of) US attack on Iran."

Although it would be more HN-worthy if there were a market on "Will the US attack Polymarket?" with as-yet-only-suspected insiders trading on that one too. ;)

I clicked curious what a "US attack on Polymarket" would look like, and was disappointed.

← PreviousPage 4 of 14Next →