HNHacker News
TopNewBestAskShowJobs

dgroshev

1,776 karma · joined September 30, 2014

submissionscomments
dgroshev··on Okmain: How to pick an OK main colour of an image
Picking the best colour is a difficult problem, I don't think there's a good general answer short of ML magic. I assembled an adversarial collection of images:

https://github.com/si14/okmain/blob/main/test_images/IMG_134...

https://github.com/si14/okmain/blob/main/test_images/pendant...

https://github.com/si14/okmain/blob/main/test_images/pendant...

https://github.com/si14/okmain/blob/main/test_images/red_moo...

https://github.com/si14/okmain/blob/main/test_images/supremu...

For every heuristic, I can think of an image that breaks it. On the other hand, I just wanted to do better than the 1x1 trick, and I think the library clears that bar.

dgroshev··on Okmain: How to pick an OK main colour of an image
Good idea, I'll add a CLI tool over the weekend.
dgroshev··on Okmain: How to pick an OK main colour of an image
Author here: the library just accepts RGB8 bitmaps, probably coming either from Rust's image crate [1] or Python's Pillow [2], which are both mature and widely used. Dealing with codecs is way out of scope.

As for loading into memory at once: I suppose I could integrate with something like libvips and stream strips out of the decoded image without holding the entire bitmap, but that'd require substantially more glue and complexity. The current approach works fine for extracting dominant colours once to save in a database.

You're right that pre-resizing the images makes everything faster, but keep in mind that k-means still requires a pretty nontrivial amount of computation.

[1]: https://crates.io/crates/image

[2]: https://pypi.org/project/pillow/

dgroshev··on Okmain: How to pick an OK main colour of an image
Random sampling makes a lot of intuitive sense, but unfortunately doesn't work well. I just answered over at lobsters: https://lobste.rs/s/t43mh5/okmain_you_have_image_you_want_co...

I should probably add this nuance to the post itself.

Edit: added a footnote

dgroshev··on Kuwaiti F/A-18's Triple Friendly Fire Shootdown Gets Stranger by the Day
> targeted by an LLM

I don't think it's a known fact at this point.

dgroshev··on How the Sriracha guys screwed over their supplier
Personally I don't like that they do that, not that they are pointing out that they do that.
dgroshev··on The changing goalposts of AGI and timelines
Just like everyone forgot about this https://www.wired.com/story/openai-staff-walk-protest-sam-al...
dgroshev··on FreeCAD
It's probably impossible for FreeCAD to catch up with the industry-standard CAD systems (SOLIDWORKS, NX, Fusion) unless they somehow pour a stupendous amount of money into their geometry kernel [1].

All major CAD systems use mature geometry kernels like Parasolid [2]. Parasolid was developed for 40 years and is still in active development. This is the piece of code that enables CAD systems to do things like computing an intersection of a G3 smooth fillet with embossed text, handling all corner cases.

FreeCAD runs on OpenCASCADE [3], which is both less sophisticated today and is slower to gain new features than Parasolid, being seemingly maintained by one person [4]. FreeCAD's geometry is hard limited by what OpenCASCADE can do.

This is the main difference from Blender. Blender ultimately operates on vertices, which doesn't require nearly the same level of inherent complexity. Blender isn't bottlenecked in what it can do like FreeCAD is.

[1]: https://en.wikipedia.org/wiki/Geometric_modeling_kernel

[2]: https://en.wikipedia.org/wiki/Parasolid

[3]: https://en.wikipedia.org/wiki/Open_Cascade_Technology

[4]: https://github.com/Open-Cascade-SAS/OCCT/commits/master/

dgroshev··on FreeCAD
I find SOLIDWORKS for Makers [1] a great middle ground between bait-and-switch "free" Fusion and the real, very expensive, deal. SW is one of industry standards, its interface is much better than FreeCAD's, and it's more powerful than both FreeCAD and Fusion. For example, both FreeCAD and Fusion struggle with G2/G3 smoothness [2] where SW doesn't even blink. Fusion doesn't allow to pattern features on sketch points (it's gated behind an expensive add-on [3]) when it's a built-in feature in SW.

[1]: https://www.solidworks.com/solution/solidworks-makers

[2]: https://www.printables.com/model/1490911-g0-g3-corners-visua...

[3]: https://www.autodesk.com/uk/products/fusion-360/design-exten...

dgroshev··on TIL: Apple Broke Time Machine Again on Tahoe
I tried moving to NFS, but the level of complexity of NFS auth is just comical. I gave up after trying to set up a Kerberos server on the Synology that I was trying to access. It's too much.

Using unauthenticated NFS, even on a local network, is too dodgy imo.

dgroshev··on Parametric CAD in Rust
Solidworks is $48/year for hobbyists though, and Fusion is free.
dgroshev··on Parametric CAD in Rust
To add to this, constructive solid geometry systems like OpenSCAD seem to be practically incapable of doing anything related to surfacing, even if it's just G2 fillets or G2 continuity (much less more advanced work with splines and patches).

I think it's partially a positive feedback loop: the "hacker" tools (OpenSCAD) influence the aesthetic (blocky/square brackets, like in the post), which in turn influences the tools. When creating a simple fillet or a chamfer is an annoying exercise in constructive geometry rather than five mouse clicks, there'll be fewer fillets, chamfers, and flowing surfaces, even when they make mechanical or manufacturing sense; but then that becomes "the look", and people don't even think about fillets.

dgroshev··on Some notes on starting to use Django
In my experience, django-ninja is a great alternative to DRF, precisely because it's so thin, unlike DRF.
dgroshev··on Some notes on starting to use Django
"Cold-blooded software" is a great term for that https://dubroy.com/blog/cold-blooded-software/ (HN: https://news.ycombinator.com/item?id=46488261 )
dgroshev··on UK House of Lords Votes to Extend Age Verification to VPNs
It takes just a few seconds to see that it's a random backbencher who is not in the government. We have a whole range of MPs, and some of them sometimes talk about things they have no idea about. The website you're citing is little more than propaganda, since it explicitly makes it seem like the MP has any connection to the government.
dgroshev··on Turso is an in-process SQL database, compatible with SQLite
It's pretty easy to get some hard data, it's an open source project. I went to https://github.com/tursodatabase/turso/pulls?q=is%3Apr+is%3A... and looked at the last few PRs:

https://github.com/tursodatabase/turso/pull/4824/files "some performance improvements", no new tests

https://github.com/tursodatabase/turso/pull/4820/ "fix wal checkpoint", one basic test

https://github.com/tursodatabase/turso/pull/4815/ "Optimizer: fix bugs, improve cost model", a lot of nontrivial logic, no new tests

https://github.com/tursodatabase/turso/pull/4814 "WAL auto truncation: increase epoch to prevent stale pages reuse", there's a new test with a comment "It is slightly fragile and can be removed if it will be unclear how to maintain it"

https://github.com/tursodatabase/turso/pull/4806/ "Busy snapshot bugfix" with two new tests with the same comments as 4814 (I guess they didn't fix the bug in one go?)

https://github.com/tursodatabase/turso/pull/4802/ "fix/translate: revert change that allowed index cursor with stale position to be read", fixes a data-corrupting bug, there's a regression test, good (although the original bug sounds like it should've been caught by a suite like the one SQLite has)

That's just a couple days worth of PRs.

This style of development does not inspire confidence. They develop features, sure. But I want my database to be rock-solid and completely covered by tests, not just move fast and break things. It's not FUD to just look at how they approach PRs.

dgroshev··on A Year of 3D Printing
CF filled filaments aren't a scam, they just have different tradeoffs: more rigid, nice surface finish, and less warping (all useful qualities!), but also lower layer adhesion, lower tensile strength, and less toughness. It's not just anecdotal, Igor Gaspar collected a lot of hard data on that.
dgroshev··on A Year of 3D Printing
There are different kinds of carbon fibres. It'd be great if it wasn't just Prusa disclosing which type they are using or offering studies on their impact, but in the meantime we can just use CF Prusament to be sure: https://www.reddit.com/r/3Dprinting/s/nQ5zUwnrWZ
dgroshev··on A Year of 3D Printing
That's largely a myth.

This review [1] cites the absolute highest amount of emitted styrene in the studies they are reviewing to be 113 μg/min. Using [2] for simplicity with styrene's molar mass (104.15 g/mol), we get to a printer creating at most 0.024 ppm of styrene per minute per m3 of unchanged air. For comparison, the "work exposure limit (WEL) for styrene is currently 100 parts per million (ppm) averaged over an 8-hour day" [4].

In other words, as long as you have some air exchange in the room, you'd be orders of magnitude away from the safe work exposure limit on styrene.

It also makes sense, considering that it's a microscopic amount of molten plastic, whereas injection moulding factories work with vats of the stuff.

[1]: https://www.sciencedirect.com/science/article/pii/S135223102...

[2]: https://teesing.com/en/tools/ppm-mg3-converter

[3]: https://en.wikipedia.org/wiki/Styrene

[4]: https://www.hse.gov.uk/plastics/faqs.htm

dgroshev··on A Year of 3D Printing
I'd encourage people doing engineering/functional parts to also try ASA and PC(-CF). Both are pretty easy to print on enclosed printer like Prusa Core One, and they offer unique qualities that are impossible to achieve with PLA or PETG.

Prusament PC Blend is insanely strong and stiff, I saw a 3mm PC bracket bending a high quality metal wood screw into an S-shape without breaking. PC-CF is much easier to print, looks great, and is stiffer still, even if a bit less strong. ASA looks great and is tougher than PC. Both creep less than PLA and PETG. Both shrug off 100C under load.

dgroshev··on A Year of 3D Printing
Less creep, slightly better at absorbing shocks without breaking, better failure behaviour (PLA can suddenly shatter leaving sharp edges, PETG tends to deform elastically first).
dgroshev··on A Year of 3D Printing
Unfortunately, even annealed HT-PLA-GF still creeps quite a bit. I find this to be the main problem using PLA as an engineering filament. For many parts it doesn't matter, of course.
dgroshev··on Predicting OpenAI's ad strategy
I wish we collectively had a better understanding of those ad tech shifts being fundamentally zero sum.

If we treat marketing as a black box, where are the benefits from supposedly more efficient marketing? Ad budgets are the same. People have the same amount of disposable income (or less, really). So on the both sides of the box converting ad budgets into paying customers the sum is the same. Quasi-monopolistic ad networks (Google and Meta) just hoovered up the money that previously went into other ad spaces, like local papers. Now OpenAI is going to fight for the same pie.

Ad tech is a market failure.

dgroshev··on Find a pub that needs you
Apologies, brain glitch: it's half, not third. Also, I'm talking about the effective tax rate, not the marginal tax rate. Here are the numbers:

Median salary of a full time employee in the UK in 2023 (to match the German source): £34,963 [1]

Take home on that salary (after income tax and NI): £28,692 [2]

Effective tax rate on a median salary in the UK: ~18%

Median salary of a full time employee in Germany: €4,479 pm [3] or €53,748 per year

Take home: €34,281 [4]

Effective tax rate on a median salary in Germany: ~36%

Tax _rates_ are not that different, but the previous British governments really ramped up the tax-free allowance, which significantly reduces the effective tax rate.

[1]: https://www.ons.gov.uk/employmentandlabourmarket/peopleinwor...

[2]: https://www.thesalarycalculator.co.uk/salary.php

[3]: https://www.destatis.de/EN/Themes/Labour/Earnings/Earnings-E...

[4]: https://salaryaftertax.com/de/salary-calculator

dgroshev··on Find a pub that needs you
The biggest problem is that the tax on a median taxpayer is not just "middling", it's a bit over a third of what a median German taxpayer is paying. The rest of the fiscal problems (convoluted tax rules, cliff edges to try to claw something back, abrupt tax increases like the one on pubs) are downstream from that.
dgroshev··on Replit founder Amjad Masad isn’t afraid of Silicon Valley
Equating surveillance flights off the coast with "operating in the country" is tenuous at best. If that's the threshold, Russian military is already operating in Britain (see Yantar's adventures).

The mental effort a lot of people has made to pretend they aren't entirely powerless and irrelevant for stopping Israel's crimes is deeply impressive. The reality is that there's nothing the UK can do to stop Israel as long as the US is supporting them (short of going to war with both the US and Israel), but this reality is at odds with the desire to do something, so people invent and inflate leverage where there isn't any. Moreover, most of the time the very same people oppose creating more leverage for the future, as your added qualifier of "post-colonial" implies. It's depressing.

dgroshev··on I wanted a camera that doesn't exist, so I built it
Another, arguably even more powerful, alternative is Rhino + Grasshopper. Grasshopper is often used for generative designs, but can include arbitrary Python nodes and can even be used for "parametrically" designed functional parts.

Grasshopper can also output gcode directly [1], enabling pretty wild things like [2].

[1]: https://interactivetextbooks.tudelft.nl/rhino-grasshopper/Gr...

[2]: https://www.instagram.com/medium_things/

dgroshev··on Revisiting the original Roomba and its simple architecture
The original Roombas were also a joy to repair. I had one for a decade, and the only thing that eventually broke was the IR sensor at the top, which left the robot unable to park. I bought a replacement, opened the robot up, and it wasn't just easy to work on, it even had captive nuts everywhere! Thank you for your work on the roombas, they were an incredible feat of consumer product engineering.
dgroshev··on Cold-blooded software (2023)
Fixed, thank you!
dgroshev··on Jeffgeerling.com has been migrated to Hugo
There's a perfect term for this Patrick Dubroy coined: "cold-blooded software" https://dubroy.com/blog/cold-blooded-software/
← PreviousPage 5 of 15Next →