HN user

listeria

65 karma
Posts1
Comments52
View on HN

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.

(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

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...

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...

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/

Layoffs at Block 5 months ago

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.

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.

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.

Just the Browser 6 months ago

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...

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".

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
Modern Linux tools 9 months ago

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.

presumably the derivation would involve a cryptographically secure, non-reversible function so as to not compromise the secret should one of them be leaked.

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.

3-JSON 12 months ago

In what ways is it unreliable? You're notified when a child is stopped, terminated, or continued, and you can make it so that you're only notified of termination using SA_NOCLDSTOP.

How is `pidfd` better, why would you use it instead of a SIGCHLD handler writing to a pipe?

3-JSON 12 months ago

The technique described in the SO answer doesn't really apply here, since the write end of the pipe would be closed on exec in that case. Whereas in this case they're waiting for it to be closed after the child dies.