I've created my first standalone Rust library! line-numbers is a simple project for finding line numbers of string offsets, efficiently: https://crates.io/crates/line-numbers
It's factored out of difftastic as it's something I want to reuse elsewhere.
miniblog.
Related Posts
I would *love* a terminal emulator that treated each command as an atomic unit, so I can efficiently scroll between them.
Line-based scrolling is annoying when you've just run a command that output 1,000 lines.
Do any such tools exist?
Efficiently sandboxing Firefox by compiling potentially vulnerable libraries to wasm, and then compiling wasm to C!
Efficiently generating random numbers in an interval 0-N https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/
The article demonstrates rejection sampling and bit masking. I've hit this problem a few times in property-based test frameworks, so it's nice to see solution techniques.
