How to gain code execution on hundreds of millions of people and popular apps
kibty.town
OlmOCR: Open-source tool to extract plain text from PDFs
olmocr.allenai.org
Why it's so hard to build a jet engine
construction-physics.com
Merlion: A Machine Learning Framework for Time Series Intelligence
github.com
400 reasons to not use Microsoft Azure
azsh.it
Inheriting is becoming nearly as important as working
economist.com
Vibe Coding and the Future of Software Engineering
alexp.pl
Japanese Toshiba Typewriter Model BW-2112 (2020) [video]
youtube.com
Troubleshooting: A skill that never goes obsolete
autodidacts.io
Show HN: Torii – a framework agnostic authentication library for Rust
github.com
Microsoft is killing Skype
windowscentral.com
Write to Escape Your Default Setting
kupajo.com
Failure Theory for Materials Science and Engineering – Richard M. Christensen
failurecriteria.com
An Update on Mozilla's Terms of Use for Firefox
blog.mozilla.org
Show HN: Betting game puzzle (Hamming neighbor sum in linear time)
Violence alters human genes for generations, researchers discover
news.ufl.edu
Surgery implants tooth material in eye as scaffolding for lens
cbc.ca
The serotonin theory of depression: a systematic review of the evidence (2022)
nature.com
Introducing a terms of use and updated privacy notice for Firefox
blog.mozilla.org
Show HN: Globstar – Open-source static analysis toolkit
Deconstructing the "Whimsical Animations" landing page
joshwcomeau.com
In Spain, there's a betting game called La Quiniela: https://es.wikipedia.org/wiki/La_Quiniela_(Espa%C3%B1a)
Players predict the outcome of 14 football matches (home win, draw, away win). You win money if you get at least 10 correct, and the prize amount depends on the number of winners. Since all bets are public, the number of winners and the corresponding payouts can be estimated for each of the 3^14 possible outcomes. We can also estimate their probabilities using bookmaker odds, allowing us to compute the expected value for each prediction.
As a side project, I wanted to analyze this, but ran into a computational bottleneck: to evaluate a prediction, I had to sum the values of all its Hamming neighbors up to distance 4. That’s nearly 20,000 neighbors per prediction (1+28+364+2912+16016=19321):
S_naive = sum from k=0 to r of [(d! / ((d-k)! * k!)) * (q-1)^k] (d=14, q=3, r=4)
This took days to run in my first implementation. Optimizing and doing it with matrices brought it down to 20 minutes—still too slow (im running it in GAS with 6 minutes limit). For a while, I used a heuristic: start from a random prediction, check its 28 nearest neighbors, move to the highest-value one, and repeat until no improvement is possible within distance 3. It worked surprisingly well.
But I kept thinking about how to solve the problem properly. Eventually, I realized that partial sums could be accumulated efficiently by exploiting overlaps: if two predictions A and B share neighbors, their shared neighbors can be computed once and reused. This is achieved through a basic transformation that I implemented using reshape, roll, and flatten (it is probably not the most efficient implementation but it is the clearest), which realigns the matrix by applying an offset in dimension i. This transformation has two key properties that enable reducing the number of summations from 19,321 to just 101:
- T(T(space, d1), d2) = T(T(space, d2), d1)
- T(space1, d) + T(space2, d) = T(space1+space2, d)
Number of sums would be the result of this expression:
S_PSA = 1 + (d - (r-1)/2) * r * (q-1)
I've generalized the algorithm for any number of dimensions, elements per dimension, and summation radius. The implementation is in pure NumPy. I have uploaded the code to colab, github and an explanation in my blog.
Apparently, this falls under Hamming neighbor summation, but I haven't found similar approaches elsewhere (maybe I'm searching poorly). If you know or you've worked on something similar, I'd love to hear your thoughts!
colab: https://colab.research.google.com/drive/1aENKd7eemGqmjdB8Y6y...
github: https://github.com/petopello/PSA
blog: https://sudapollismo.substack.com/p/partial-sum-accumulation...