HNHacker News
TopNewBestAskShowJobs

xolox

88 karma · joined November 26, 2010

homepage: peterodding.com

projects: github.com/xolox

[ my public key: https://keybase.io/xolox; my proof: https://keybase.io/xolox/sigs/948lRZnvUsgJ3uouKswo7YRYHftY6cGKAEwG3tJglYc ]

submissionscomments
xolox··on Techniques I use to create a great user experience for shell scripts
I use the same heuristic for when I should switch from shell to Python :-). Arrays (especially associative ones, at least for me) are a good indication that a more advanced language like Python might be more appropriate than shell.
xolox··on Swift is a more convenient Rust
malloc/free are for heap based allocations. The grand parent explicitly mentioned he was referring to stack based allocations, which are kind of automatic (implicit).
xolox··on From Linux to NetBSD, with SSH Only
Compliments to the author for clearly explaining all of the steps involved. I've never gone this deep, although I have previously converted remote headless Linux servers to full disk encryption using similar techniques. Thanks for sharing!
xolox··on Pongamia trees grow where citrus once flourished
I think toxicity is a relative concept, not absolute. I mean you can die from drinking too much water (https://en.wikipedia.org/wiki/Water_intoxication) yet at the same time you need to drink plenty of water to survive. People have been making this point better than I ever could for hundreds of years: https://en.wikipedia.org/wiki/The_dose_makes_the_poison
xolox··on Why many studies wrongly claim it's healthy to drink a little alcohol
If you make a bookmarklet to look up the current page on archive.is you'll never have this problem again :-). Here's the link for this article: https://archive.is/9QF2j
xolox··on Caffeine suppresses cerebral grey matter responses to chronic sleep restriction
I got into fermented foods to improve my health, and quite a few of these are acquired tastes for me (and surely also for lots of other people). Milk kefir, water kefir, kombucha, tempeh, koji, natto, these things challenge the taste palate of someone who grew up in the Western world without exposure to fermented foods (e.g. a strong sourness to foods and drinks). I grew to appreciate and in some cases love them because I know what they do for my health. Nowadays I regularly crave fermented foods, but when I started taking them I had to force myself to get accustomed to them.
xolox··on Ask HN: Has anyone been fired for ignoring in-office mandates?
I don't mean to come off as ignorant (so please correct me if I am wrong) but could it be that the so-called "two-party system" in the US is to blame for some of the polarization implied in your message?

As someone living in the Netherlands and being used to dozens of political parties with various ideologies and convictions, the two-party system of the US has always surprised me as being extremely limiting (e.g. if you don't naturally identify with Democratic ideologies you vote Republican or vice versa).

Edit: None of this is to imply that Western Europe or the Netherlands doesn't have major political issues, for example I'm quite disillusioned about the uptick in popularity of populist political parties (throughout Western Europe but also specifically in the Netherlands).

xolox··on Twilio confirms data breach after hackers leak 33M Authy user phone numbers
That is not the TLDR I intended. If you store your OTP secrets in the same password store that also stores your regular passwords, you've just completely undermined the second factor of security.
xolox··on Ask HN: Is there any software you only made for your own use but nobody else?
Over the years I've built lots of small and large tools for personal use, some of them I'm still planning to release as open source "one day", others I have no intention of ever releasing.

One of the biggest and most useful of those tools is a Django web interface that accepts JPG/PNG/PDF file uploads of scanned documents and in case of images (JPG/PNG) it will run "tesseract" to OCR extract text from the images (in case of PDF it will pdf2txt). The extracted text is stored in an SQLite database which enables keyword search in the uploaded documents.

I use this as my (digital) archive of important documents, e.g. mortgage, bank statements, insurance, medical files, etc. I just checked and I now have 1129 documents in there ranging all the way back to 2006 .

It's super useful to be able to go back in time digitally, without having to dive into the collection of physical binders with the real documents (ordered by year and month but nothing beyond that, given that there are usually only a handful of documents per month, and I can use the web interface as an index into the physical archive, if I ever need it).

xolox··on Twilio confirms data breach after hackers leak 33M Authy user phone numbers
I'm really sorry for the situation you find yourself in and agree that it sucks. I'm replying because I want to mention that it is possible to use 2FA without any form of vendor lock-in (although I realize this doesn't help you retrospectively fix your existing issue). I'm not trying to be a wise ass, I just want to share some pointers for folks who are interested in avoiding or remedying this problem (which is a bit of a tricky problem).

I've been using pass (https://www.passwordstore.org/) for quite a few years now and it allows to use multiple GPG keys to encrypt secrets in different subfolders. So I have a default GPG key that encrypts all my regular passwords, protected by a master password that is easy enough that I can regularly type it in on my smartphone.

Then I have a second GPG key with a much more complicated password that I use to encrypt my 2FA secrets (strings like "FX5D MJE8 F9F9 XFE0" that can be used to "seed" apps like Google Authenticator). These 2FA secrets I never access on my smartphone, I only access them on my laptop where I have a proper keyboard to type in the absurdly long password required to unlock these.

I wrote a small Python script that takes a 2FA secret and uses it to generate a TOTP URL that is then fed to "qrencode" (a command line program available on Linux and MacOS) which renders a QR code that I can scan into a TOTP app like Google Authenticator (like if I was first signing up for 2FA via the original website or service, the only thing that changes is who generates the QR code and when).

Because I saved the original 2FA "seeds" (my term, not sure what the proper term is here, but it's akin to the seed you feed into a random number generator) I can regenerate the QR code whenever I wish, which means that if my smartphone dies and I lose the 2FA secrets loaded into Google Authenticator, I can take an empty new smartphone, install Google Authenticator, and rescan all of the QR codes that bootstrap my 2FA sequences via my laptop. The other side (the website or service where I enabled 2FA) never needs to know I went through this procedure, in fact fundamentally it cannot know.

I've been using this same scheme to share 2FA codes with a team of system administrators so that we can properly protect e.g. AWS root accounts while still providing multiple individuals access without being tied to a single smartphone or 2FA app.

So long story short, it is possible, although admittedly (my way) it does require some cobbling together of different tools in order to get a workflow that handles this smoothly. But I sleep better at night knowing that all of my important accounts are protected by 2FA yet I can never be locked out of them, even if I lose my smartphone or laptop (the actual password store git repository lives on my server where it is backed up to several disks every couple of hours).

xolox··on Why not parse `ls` and what to do instead
Thanks for clarifying, I learned something new today!

Edit: It turns out that Bash does substitutions in the middle of strings using the ${string/substring/replacement} and ${string//substring/replacement} syntax, for more details see https://tldp.org/LDP/abs/html/string-manipulation.html

xolox··on Why not parse `ls` and what to do instead
With regards to parted, if you only want to query for information, there is "partx" whose output was purposefully designed to be parsed. I have good experiences with it.
xolox··on Why not parse `ls` and what to do instead
Note this string replacement is not anchored (right?) which can end up biting you badly (depending on circumstances of course).
xolox··on Why not parse `ls` and what to do instead
Both `find -exec` and xargs expect an executable command whereas `while read; ...; done` executes inline shell code.

Of course you can pass `sh -c '...'` (or Bash or $SHELL) to `find -exec` or xargs but then you easily get into quoting hell for anything non-trivial, especially if you need to share state from the parent process to the (grand) child process.

You can actually get `find -exec` and xargs to execute a function defined in the parent shell script (the one that's running the `find -exec` or xargs child process) using `export -f` but to me this feels like a somewhat obscure use case versus just using an inline while loop.

xolox··on Let insects eat your plants
I grow mushrooms as a hobby and in that context my number one enemy is trichoderma, the green mold. This is because trichoderma is parasitic on other fungi, i.e. it doesn't colonize the substrates that I grow my fungi on, it directly colonizes (eats) the fungal threads (mycelium) thereby killing it off before it has a chance to "fruit" (produce mushrooms).

This is how I initially learned that trichoderma is used as a natural "fungicide". In your specific case it might be interesting to investigate this in more detail, e.g. you can "inoculate" your soil with copious amounts of trichoderma to fight off other fungi.

For more details here's a pointer to a rabbit hole: https://www.google.com/search?q=trichoderma+fungicide

Sorry if you know all of this already, I was hoping it might help :-).

xolox··on Our biggest ever river catch?
This is completely disregarding the impact of microplastics on the health of animals, plants and ecosystems (FWIW I am aware that bioplastics shed microplastics as well).
xolox··on Study puts fermented foods, not fire, as pivotal moment in human brain growth
Okay I understand what you mean now (still don't agree). I'm having a hard time envisioning companies involved in the fermented foods scene coming together and "lobbying" to push their "agenda" but who knows, maybe I'm being naive! ;-)
xolox··on Study puts fermented foods, not fire, as pivotal moment in human brain growth
> It helps foster the desire for fermented food, ie its a means to shift premium product off shelves.

Sorry but this sounds disingenuous to me. Isn't one of the hallmarks of fermented foods that you can prepare them at home, fairly cheaply in lots of cases? It is to me...

xolox··on Study puts fermented foods, not fire, as pivotal moment in human brain growth
I regularly make (grow) tempeh and koji and both require a food dehydrator to keep the temperature around 30°C for the duration of the fermentation (in my case, living in the Netherlands, so Western Europe). Both tempeh and koji are molds (mycelium that doesn't produce mushrooms).

I also make milk kefir, water kefir, sourdough and kombucha and while none of these cultures require the higher temperatures, they do thrive in the higher temperatures.

I also grow quite a few species of mushrooms and have learned that a lot of species incubate quite aggressively at higher temperatures (25-35°C).

xolox··on Home Assistant: Three years later
I run Home Assistant from a "manually managed" Python virtual environment as well, and have been doing so for years. It works fine. The developers are quite aggressive in insisting on recent Python releases, so upgrading is always a bit of work, but it's manageable. I'm using supervisord to keep Home Assistant (and AppDaemon) running, but you could use systemd as well.
xolox··on Home Assistant: Three years later
I suspect they are referring to using a Raspberry Pi and using a micro SD card as the main storage mechanism. This is known to be a bad combination that will fail at an unfortunate time, sooner rather than later.

Personally I boot my Raspberry's using netboot (DHCP via dnsmasq) and NFS. However I don't run Home Assistant on a Raspberry, it runs on the "server" (headless machine) that's serving NFS .

xolox··on Home Assistant: Three years later
This is a good idea, however one drawback is that Home Assistant sometimes needs "physical access" to devices connected to the computer that it's running on, for example Bluetooth and Zigbee dongles. Of course you can pass through such access to a virtual machine, but it does become somewhat nontrivial.
xolox··on Home Assistant: Three years later
I've had plenty of trouble with Home Assistant upgrades randomly breaking smart devices from well known vendors, e.g. whenever I update I dread to find out whether my Neato vacuum robot is still supported or whether that integration has crapped out again. Same for my LG smart tv and several other devices. I love Home Assistant but it's not exactly rock solid...
xolox··on Home Assistant: Three years later
> If I'm not adding new hardware or exposing services to the public why would I need to update anything?

Because you might be using a web browser and/or email client to interface with the outside world...?

xolox··on Open-sourcing AudioCraft: Generative AI for audio
Tip: If you run `pip uninstall audiocraft` it should render an interactive confirmation prompt that explains which files it is about to remove, this should help to understand where the library was installed (of course you don't have to confirm the prompt, just press Control-C or answer "No" to the prompt once you have your answer).

Disregarding the tip above, determining where the library was installed requires a bit of context, for example your platform (Windows versus UNIX) and the fact that newer pip releases default to "pip install --user" when not running with super-user privileges, whereas older pip releases did not default to "pip install --user".

Assuming you are using Linux and using an up-to-date pip release and you ran the "pip install -U audiocraft" command without super-user privileges, then the library was most likely installed in ~/.local/lib/pythonX.Y/site-packages (where X.Y is the version of Python that was used by the pip command you ran).

xolox··on Show HN: Mox - Modern full-featured low-maintenance self-hosted mail server
By definition most of them won't because it's a complicated mess.
xolox··on Show HN: boxxy – Control where Linux programs put files, without symlinks
Who cares how the feature of hidden files came to be, when it has been what it is now for so many years?
xolox··on I bought a CO2 monitor and it broke me
I got my Aranet4 because it had very good reviews and allowed local read out of sensor data without any "cloud" involvement. I've been very happy with it, the readings are integrated into my Home Assistant setup so automations can respond to high CO2 (e.g. turn on a fan directed at a window, when temperatures are high enough to have a window open).
xolox··on Drew Devault to write less due to his experiences with internet toxicity
I can't speak for the submitter but this stood out to me:

> Each new article spurs less discussion than the last, but provides an unwavering supply of spiteful responses.

xolox··on Ask HN: Indoor air quality sensors and other IoT that's local-first and not DIY?
The Aranet4 device is a non-DIY CO2 sensor however it operates over Bluetooth instead of Zigbee, not sure how much of a deal breaker that is for you. I had no trouble hooking it up to my Home Assistant setup though, and the device is fairly affordable (for a "proper" CO2 sensor that is, not one of those Ali Express devices that estimates CO2 by VOC measurements).
← PreviousPage 2 of 3Next →