HNHacker News
TopNewBestAskShowJobs

listeria

68 karma · joined September 14, 2023

submissionscomments
listeria··on Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache
Depends on how the CacheEntry is stored, it's probably stored in a slice of &[CacheEntry] which precludes storing the record data alongside it as the size of each entry must be fixed.
listeria··on Using GCC's Nested Functions with Wide Pointers and No Trampolines II
Well, if you're already using qsort_r, what's the point of using nested functions, if you can have a context pointer with the target?

And if you're not using qsort_r, but reaching for _Thread_local, the target can be _Thread_local instead of dsq.

listeria··on How to corrupt an SQLite database file
killing a process which is using SQLite shouldn't corrupt the database, same as pulling the plug.
listeria··on Zig's new bitCast semantics and LLVM back end improvements
When I first found out about bit fields in C, I was left wondering what the order of bits was in a byte, eventually I convinced myself it doesn't matter, since the byte is the smallest I/O unit, and lived with the fact that casting between bitfields and bytes was UB (or unspecified, I can't remember), and as such, was another thing I wasn't suppossed to do when writing C.

All this to say that Zig just keeps cleaning up and giving well-defined semantics to warts I learned to live with in C.

listeria··on The 29th International Obfuscated C Code Contest (IOCCC) 2025 Winners
(1) fails for negative numbers

(2) fails for (x % 32 in [1, 2]) due to UB

(3) fails for x == 2

(4) crashes for x == 0

(5) is the same polynomial, only factorized

(6) always returns 0

(7) is the same polynomail reordered

But this works for any value of x:

  x<2==2-x
or for something shorter:

  x<3&x>0
but that's not bery obfuscated
listeria··on You can beat the binary search
This reminds me of two excellent articles[1][2] by Paul Khuong, in which he talks about using size-specialized binary search for power-of-two sized arrays (special-casing the first iteration for other sizes).

He uses conditional moves and defines the number of iterations in advance to ellide the often mispredicted branch, and in the second article goes on to fix cache aliasing issues for large vectors using ternary search.

[1]: https://pvk.ca/Blog/2012/07/03/binary-search-star-eliminates...

[2]: https://pvk.ca/Blog/2012/07/30/binary-search-is-a-pathologic...

listeria··on Relicensing with AI-Assisted Rewrite
Apparently there was some talk a few years ago about adding the project to the python standard library[1] and the maintainer seems really[2] interested[3] in that.

But I don't think the standard library maintainers would want to incorporate it considering the way in which the relicensing took place, the controversy, and the implications on software licences in general. So his motivations for the license change seem moot. I certainly wouldn't touch it with a 10-foot pole.

[1]: https://github.com/chardet/chardet/issues/36#issuecomment-76... [2]: https://github.com/chardet/chardet/issues/327#issuecomment-4... [3]: https://github.com/chardet/chardet/issues/327#issuecomment-4...

listeria··on Meta’s AI smart glasses and data privacy concerns
Have you tried bringing it up with HR? If you explain why you try to avoid her while she's wearing them, they might ask her to stop wearing them to work.

Meta's own guidelines[1] say that you should "Power off in private spaces."

You can't always tell if you're being recorded since they can be tampered with to disable the LED. And from what I gather, the LED only serves to indicate of video recording, and not necessarily audio.

[1]: https://www.meta.com/ai-glasses/privacy/

listeria··on Layoffs at Block
But the definition of economically active differs between the two: Finland includes people from ages 15-89, while in Spain you need to be 16 or older. And judging from what I read the rise in unemployment in Finland is attributed to more people entering the workforce.
listeria··on Why is the sky blue?
If you look at the solar radiation spectrum chart in the section "Why isn’t the sky violet?", you can see that sunlight is not evenly distributed along the visible spectrum--it emit more blue than red, and at sea level it's closer to evenly distributed. So the light that reaches the clouds is still mostly white light.
listeria··on Start all of your commands with a comma (2009)
Global aliases are a zsh feature and not avaliable in bash. So if you want:

  openssl ,v
to expand to...

  openssl --version
readline seems like the way to go.

Then again most of the examples OP gave are usually available as short options, and aliasing ,s to sudo is certainly possible. So the only one which makes sense to me is ,,=$. But it's probably not worth the trouble to my muscle memory.

listeria··on Doom has been ported to an earbud
and risk having them interpret it as a declaration of war?
listeria··on Banned C++ features in Chromium
may I introduce you to the nodiscard attribute[1]?

  enum (class)? [[nodiscard]] Error {
    Ok,
    NoMem,
    ...
  };
[1]: https://en.cppreference.com/w/cpp/language/attributes/nodisc...
listeria··on Just the Browser
Firefox will read it if it exists[1]. You could use the /usr/lib/firefox/distribution directory (or whatever the installation directory may be), but that may be overwritten by an update.

There doesn't seem to be any way to set per-user group policies, so unless you're installing firefox in a user-controlled directory, it will require elevated privileges.

[1]: https://support.mozilla.org/en-US/kb/customizing-firefox-usi...

listeria··on Nabokov's guide to foreigners learning Russian
> The books were translated years ago anyway.

Translated books lack the nuance or tone of the originals, which you would be missing out of, and most of the time you don't even realise.

listeria··on CLI tool to check the Git status of multiple projects

  sh: 1: [[: not found
listeria··on Rouille – Rust Programming, in French
That's all well and good, except the README clearly states:

> rústico (Spanish for Rust)

which is plain wrong.

listeria··on Rouille – Rust Programming, in French
I was immediately put off by the Spanish version when I saw it was called "rústico", which does not translate to rust at all, it means rustic. The Spanish word for rust would be "óxido".
listeria··on US declines to join more than 70 countries in signing UN cybercrime treaty
you can see at the top of the page it says:

  STATUS AS AT : 30-10-2025 09:16:00 EDT
and the date of the signature says 25 Oct 2025.
listeria··on US declines to join more than 70 countries in signing UN cybercrime treaty
full list of signatories: https://treaties.un.org/Pages/ViewDetails.aspx?src=TREATY&mt...
listeria··on 987654321 / 123456789
in the b=2 case, you get:

  1 / 1 = 1 = b - 1
  1 % 1 = 0 = b - 2
they are the other way around, see for example the b=3 case:

  21 (base 3) = 7
  12 (base 3) = 5
  7 / 5 = 1 = b - 2
  7 % 5 = 2 = b - 1
listeria··on Modern Linux tools
Maybe it should be called "lest"? As in a less/most replacement written in rust. Although it does divert from the theme of more/less/most.
listeria··on Show HN: Kent Dybvig's Scheme Machine in 400 Lines of C (Heap-Memory Model)
> I wonder if an LLM would be up to the job of writing the assembly code from this?

I could see a compiler doing that.

listeria··on Pass: Unix Password Manager
presumably the derivation would involve a cryptographically secure, non-reversible function so as to not compromise the secret should one of them be leaked.
listeria··on The future of 32-bit support in the kernel
It's actually seconds since epoch, not milliseconds. Here's a small program to verify it:

  date -u --date='2038-01-19T03:14:08' +%s | perl -ne 'printf "%#x\n", $_'
It is also mentioned in perldoc Time::Piece [1], as a warning for people whose build of perl uses 32-bit integers for time.

[1]: https://perldoc.perl.org/Time::Piece#Use-of-epoch-seconds

listeria··on Waitgroups: What they are, how to use them and what changed with Go 1.25
It's called struct embedding, there an article about it in Go by Example if you're interested: https://gobyexample.com/struct-embedding
listeria··on Waitgroups: What they are, how to use them and what changed with Go 1.25
something like this would do it:

  package main
  
  import (
    "sync"
    "time"
  )
  
  type WaitGroup struct {
    sync.WaitGroup
  }
  
  func (wg *WaitGroup) Go(fn func()) {
    wg.Add(1)
    go func() {
      defer wg.Done()
      fn()
    }()
  }
  
  func main() {
    var wg WaitGroup
    wg.Go(func() { time.Sleep(1 * time.Second) })
    wg.Wait()
  }
listeria··on A fast, growable array with stable pointers in C
They link to an old article [1] that was featured in HN [2] somewhat recently, in which there's a workaround for older standards with regards to typeof.

[1]: https://danielchasehooper.com/posts/typechecked-generic-c-da...

[2]: https://news.ycombinator.com/item?id=44425461

listeria··on A fast, growable array with stable pointers in C
They mention using this as the backing array for a power-of-two-sized hash table, but I don't think it would be very useful considering that the hash table won't provide stable pointers, given that you would need to rehash every element as the table grows. Even if you just wanted to reuse the memory, rehashing in-place would be a PITA.
listeria··on Slow
From TFA

> This page is a riff on Patrick Collison's list of /fast projects.

Maybe as a HN post, but the blog is in response to https://patrickcollison.com/fast

Page 1 of 2Next →