HNHacker News
TopNewBestAskShowJobs

jbboehr

242 karma · joined July 23, 2015

Hell is other people’s code.
submissionscomments
jbboehr··on Against learning from dramatic events
See also: Reinsurance

> Reinsurance is insurance that an insurance company purchases from another insurance company to insulate itself (at least in part) from the risk of a major claims event.

https://en.wikipedia.org/wiki/Reinsurance

jbboehr··on NixOS: Declarative Builds and Deployments
My experience with apt is that, while you can pin versions of packages once they're installed, they may not exist indefinitely in the mirrors.

Whereas Nix keeps binaries around longer, but also includes the ability to automatically and reproducibly build from source.

jbboehr··on OpenD, a D language fork that is open to your contributions
> Rust requires unsafe code to implement any non-trivial data structures

That seems like a gross overstatement.

https://github.com/rust-lang/rust/blob/master/library/std/sr...

CTRL-F: unsafe

Only one result, an optional utility function: "pub unsafe fn get_many_unchecked_mut"

jbboehr··on Nuclear battery produces power for 50 years without needing to charge
> I've seen it said

You can estimate it yourself:

0.5 ^ 10 = 0.0009765625 (~0.1%)

https://en.wikipedia.org/wiki/Half-life#Probabilistic_nature

> When there are many identical atoms decaying, the law of large numbers suggests that it is a very good approximation to say that half of the atoms remain after one half-life

jbboehr··on 4B If Statements
Perhaps Nock:

https://developers.urbit.org/reference/nock/definition

> The reader might wonder how an interpreter whose only arithmetic operation is increment can ever be practical.

> The short answer is that a Nock interpreter doesn't have to use the algorithm above. It just has to get the same result as the algorithm above.

jbboehr··on Windows NT on 600MHz machine opens apps instantly. What happened?
Perhaps it's this one?

http://danluu.com/input-lag/

jbboehr··on PHP in 2023
> Auto setting strictness for every file in your project and checking for it in CI clears the issue, but that becomes another boilerplate you’re adding to your system

There was this RFC[0] but it seems to have fizzled.

> And it still doesn’t work for native functions.

The page states: 'Function calls from within internal functions will not be affected by the strict_types declaration' (emphasis mine). Outside of array_map I don't think this happens all that much.

> So in the end, the best option is to _not_ type scalar parameters, and do the strict check manually and throw your own TypeError, inside your function instead.

That sounds awful. Why not install a nice static analyzer like phpstan or psalm and never think about it again?

[0]: https://wiki.php.net/rfc/namespace_scoped_declares

jbboehr··on PHP in 2023
> declaring a type will force cast parameters to that type instead of throwing an error

There is `declare(strict_types=1)`[0]

[0]: https://www.php.net/manual/en/language.types.declarations.ph...

jbboehr··on VanillaOS: Immutable Ubuntu-Based Linux
I was dead serious :) Although it seems nginx is bit complicated[0], in general, it's fairly easy to set up new systemd services.

[0]: https://github.com/NixOS/nixpkgs/blob/nixos-22.11/nixos/modu...

jbboehr··on VanillaOS: Immutable Ubuntu-Based Linux
NixOS needs to handle generating the config to make service configurations composable. If you don't want that, you might as well write your own systemd unit.

That being said, most services have an option to use verbatim configuration files[0] or fragments[1][2][3].

[0]: https://search.nixos.org/options?show=services.yggdrasil.con... [1]: https://search.nixos.org/options?show=services.nginx.config [2]: https://search.nixos.org/options?show=services.bind.extraCon... [3]: https://search.nixos.org/options?show=services.nginx.appendC...

jbboehr··on New in Go 1.20: wrapping multiple errors
To be clear, I meant it as a general phenomenon and wasn't directed at you. I see a lot of the same thing on reddit, etc. Metric vs imperial is an almost-daily comment chain in the Oxygen Not Included subreddit, for example. It just gets a bit tiring to see the same discussion again and again.

(edit) I'm perfectly fine using 8601 in technical contexts, or anywhere really, but describing American cultural practices as "insane" and "bizarre" is exactly what I'm talking about.

jbboehr··on New in Go 1.20: wrapping multiple errors
> it's definitely not "insane" and not "bizzare". Why would anyone even claim that?

Pretty sure it's just anti-American signalling/globalist cultural imperialism. Asian/8601 date format makes a lot more "logical" sense, but nothing beats what you grew up using, at least for me, in a non-technical context.

jbboehr··on Considering C99 for Curl
`-Wformat-security` [0] to the rescue!

[0]: https://fedoraproject.org/wiki/Format-Security-FAQ

jbboehr··on PHP 8.2.0 RC1 available for testing
PHP isn't really used as a template language any more. Most people use a different template language for the views. I've implemented two myself[0][1] but an early one was Smarty[2] and there are many others. I hear Twig is pretty good[3].

[0]: https://github.com/jbboehr/php-handlebars [1]: https://github.com/jbboehr/php-mustache [2]: https://www.smarty.net/ [3]: https://twig.symfony.com/

jbboehr··on PHP 8.2.0 RC1 available for testing

  $ php -r 'var_dump("0x10" == "16z");'
  bool(false)
  
  $ php -r 'var_dump(0x10 == "16z");'
  bool(false)
  
  $ php -r 'var_dump(0x10 == (int)"16z");'
  bool(true)
jbboehr··on A new vertical farm will grow 3M pounds of mycelium a year for fungi-based bacon
Seems like it has no historical usage[0] and is not a valid form of fungus[1], from what I can tell. Kind of a weird choice.

[0]: https://en.wiktionary.org/wiki/funga [1]: https://en.wiktionary.org/wiki/fungus#Declension

jbboehr··on SSH commit verification now supported
You can use your GPG key as an SSH key[0], and you'll also only need to manage one key - although that doesn't fix whatever issues you might have with GPG, of course.

[0]: https://wiki.archlinux.org/title/GnuPG#SSH_agent

jbboehr··on Nixpacks takes a source directory and produces an OCI compliant image
Do builds use sandboxing? It appears not[0], is this in the roadmap? Based on my experiences with node2nix, composer2nix, carnix, etc, I don't blame you for not going that route. Not to knock on the developers of those tools - it's a difficult problem. I apologize if my interpretation is incorrect.

[0]: https://github.com/railwayapp/nixpacks/blob/60ab563fdc9bf4fb...

jbboehr··on Ask HN: Can I see your scripts?
There is also oathtool:

https://manpages.ubuntu.com/manpages/bionic/man1/oathtool.1....

jbboehr··on Burn All GIFs (2000)
I tried this once for animated video thumbnails in a feed. It was about as awful as you can imagine.
jbboehr··on The Unreasonable Effectiveness of Makefiles
Yes, I used autotools[0]. It's definitely hairier than plain make, but you get a lot of useful features on top of it. There's thousands of examples all over the internet so it's easy to reference them.

I like the elegance of pure make, and do use it when appropriate, but I wouldn't really want to reimplement the things autotools does myself in it.

[0]: https://github.com/jbboehr/handlebars.c/blob/master/configur...

jbboehr··on The Unreasonable Effectiveness of Makefiles
Yeah, I did this too. It's not that surprising considering that typically end-users only interact with phony targets (all, clean, install, etc).
jbboehr··on The Unreasonable Effectiveness of Makefiles
> All of this was inspired by someone who replaced the rc scripts in their init system with a Makefile in order to allow processes to start in parallel while keeping the dependencies in the right order.

Any sufficiently complicated init system contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of systemd.

jbboehr··on Advanced Metaprogramming in C: A select statement
Procedural macros[0] in Rust seem to fit this a bit. Although you don't see the generated code unless you use something like cargo-expand[1].

[0]: https://doc.rust-lang.org/reference/procedural-macros.html [1]: https://github.com/dtolnay/cargo-expand

jbboehr··on Redis explained
You can also "leak" rows in a traditional RDBMS or even a filesystem. Why is this particular notable for Redis?
jbboehr··on W4 Games formed to strengthen Godot ecosystem
Stellaris was ported to console and works fairly well! I still would rather play it with a keyboard and mouse, of course :)
jbboehr··on Our Roadmap for Nix
Listing all packages is a bit of a weak spot. The entire package set is described in a lazy, functional language and listing or searching it requires evaluating the entire thing. A normal build will only require evaluating a small subset of the entire package list. `nix search` should have caching of results but it still requires evaluation to be populated.
jbboehr··on I still love PHP and JavaScript
Phar[0] is used for some command line tools (for example composer), I wonder why it's not used more in web applications?

[0]: https://www.php.net/phar

jbboehr··on Using Nix on macOS
Have you seen pnpm[0]? Has some similarities.

> Files inside node_modules are cloned or hard linked from a single content-addressable storage

Also (IIRC, it's been a long while) it's lockfile contains enough information to translate it directly to a Nix derivation[1].

[0]: https://pnpm.io/ [1]: https://github.com/nix-community/pnpm2nix

jbboehr··on Building a Cloud Database from Scratch: Why We Moved from C++ to Rust
talloc[0] is a pretty cool allocator that also has the ability to do this sort of thing.

[0]: https://talloc.samba.org/talloc/doc/html/index.html

← PreviousPage 2 of 6Next →