HNHacker News
TopNewBestAskShowJobs

Pete_D

1,119 karma · joined November 22, 2013

submissionscomments
Pete_D··on UK Election Tech Handbook
"alternative vote" is the term the UK ended up using for instant-runoff voting when it had a referendum a few years back.

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

Pete_D··on Feeling stuck? Write a poem
xterm in autumn

thick red and amber carpet -

unit test results.

Pete_D··on Prenatal THC exposure yields hyperdopaminergic phenotype rescued by pregnenolone
Fair enough, another commenter already gave 2mg/kg, but I should have quoted it too really. Edited with more detail.
Pete_D··on Prenatal THC exposure yields hyperdopaminergic phenotype rescued by pregnenolone
Looks complicated. https://en.wikipedia.org/wiki/Allometry#Drug_dose_scaling
Pete_D··on Prenatal THC exposure yields hyperdopaminergic phenotype rescued by pregnenolone
Study says: "... we modeled PCE by administering THC (2 mg per kg, subcutaneously (s.c.) once daily) to rat dams during pregnancy (from gestational day (GD) 5 until GD20). This low THC dose does not recapitulate behavioral responses in the can-nabinoid tetrad assay or elicits cannabinoid tolerance after repeated administration, hence it represents a mild insult without any substantial direct impact on maternal behavior. ... In terms of human consumption, this dose is equivalent to THC content in mild cannabis cigarettes (joints) (5%), since the average THC content in illicit cannabis preparations has significantly increased in the last two decades (from ~4% to ~12%)."
Pete_D··on YARA – A pattern-matching Swiss knife for malware researchers
The syntax isn't as nice as YARA's, but you can extend file's capabilities if you need by writing a custom magic file - see 'man 5 magic'.
Pete_D··on Pizza Hut’s First Website
2004, a perl script pizza_party is published allowing to buy pizza from the command line. I think it was even in some distros' package managers for a while.

Slashdot discussion: https://entertainment.slashdot.org/story/04/05/07/138238/piz...

Archive of project homepage: https://web.archive.org/web/20040508090713/http://www.beiger...

Pete_D··on The Earliest Unix Code: An Anniversary Source Code Release
If my reading is right, it filters out any with a leading null-byte before writing back out. My guess is that that is how they implemented unlink/rm - just write zeroes over the entry.

As for the sys write: my current hypothesis is that .. there is a placeholder for an argument which is written to by the preceding dac .+4. ('"If a program can't rewrite its own code", he asked, "what good is it?"'). But I can't make sense of what it's actually putting there - I'd guess length, but it looks like ~(dir - 2) + 8.

Pete_D··on The Earliest Unix Code: An Anniversary Source Code Release
After staring at the listing for a while, I think it is a kind of garbage collector for removing unlinked files from directory listings ("pack directory"?). As best as I can work out, the code does:

    open ..
    loop
        read a directory entry into tbuf
        if we read 0 bytes (eof presumably), break loop
        if tbuf[0] == '\0', go back to start of loop
        append tbuf to dir
    done
    close ..
    reopen .. with creat
    write the stuff we built up into dir to ..
    close ..
    exit
Pete_D··on The Earliest Unix Code: An Anniversary Source Code Release
dir appears to be copied into from tbuf at some point. It puts dir-1 into memory location 8 at the start, and then the code around the 2: section I'm pretty sure is a memcpy-ish loop like:

    c1 = -8;
    *9 = tbuf - 1;
    do {
        *(++(*8)) = *(++(*9));
    } while(++c1 != 0);
    goto 1b; // b for backwards?
It seems that memory locations 8-15 are auto-indexing[0], so the lac/dac i increments the pointed-at location before use, and isz is "increment and skip next instruction if zero".

[0] PDP7 manual, big PDF: http://bitsavers.trailing-edge.com/pdf/dec/pdp7/F-75P_PDP7pr...

Pete_D··on The Earliest Unix Code: An Anniversary Source Code Release
> Maybe ‘pd’ is something like ‘prepare directory’, constructing the dd/dotdot entry.

I think this is on the right track - it looks like the write call is to the newly created .., with df being used to hold the file descriptor.

Pete_D··on Stupid Unix Tricks
CentOS 6 lives on in enterprise, unfortunately. (don't know exact OpenSSH version but didn't support -J when I checked earlier)
Pete_D··on The Unix Game
This looks like fun. It'd be really nice if there was an option to just type the commands in instead of using the GUI, though I guess that would defeat the purpose a bit.
Pete_D··on ScummVM 2.1.0
> Now someone get on making Monkey Island 3 please.

They already did, or am I misunderstanding? https://en.wikipedia.org/wiki/The_Curse_of_Monkey_Island

Pete_D··on Why Do People Neglect Maintenance?
Here's a reason I heard once. I've never heard anyone else mention it, so it's probably BS, maybe a lawyer or accountant can confirm or deny.

Developing new features is classed as "productive" or "R&D" or such, which means companies can claim some kind of tech subsidy or tax rebate on employees' wages for time spent doing it.

Maintenance tasks like fixing bugs and upgrading servers don't come under this classification, so they can't.

The incentives are thus set up for upper management to push against and actively neglect maintenance efforts.

Pete_D··on Computational survivalist
> unix wizards will tell me a better way of doing this

Great story. I won't claim to be a wizard, but here's mine:

    grep -Eo "mailto:[^\"']*" webpage.html | sed 's/^mailto://' | sort -u
The pattern means "mailto: and then everything up to a single or double quote", and the -o flag means "only show the matches". The main benefit of this approach is that it works even if you have multiple email addresses on a line.
Pete_D··on English has been my pain for 15 years (2013)
> in a country that must have 50 regional terms for a bread roll.

This is so controversial that some regions have propaganda music videos about it: https://www.youtube.com/watch?v=O98qd7-dAaU

Pete_D··on Facebook, WhatsApp Will Have to Share Messages With U.K.?
(disclaimer, speculation) The Times article says this has been in progress for four years, so I suspect that this is the culmination of https://wiki.openrightsgroup.org/wiki/UK-US_Bilateral_Agreem.... Which was originally planned to be encryption-neutral, but maybe things have changed in the past two years.
Pete_D··on Ultraprocessed Foods – A New Theory of Obesity
(standard disclaimers apply; I am not a dietician or otherwise formally qualified to have any opinion at all on this topic)

It looks like they're using the NOVA classifications[0]; there have been a couple of other articles relating to the same system posted here recently, e.g. [1].

The NutriSource in "Whole milk (Cloverland) with NutriSource fiber" is apparently 100% partially hydrolyzed guar gum[2], which I believe would qualify the combination as ultraprocessed under this part of the definition from [0]: "Substances only found in ultra-processed products include some directly extracted from foods, such as casein, lactose, whey, and gluten, and some derived from further processing of food constituents, such as hydrogenated or interesterified oils, hydrolysed proteins, soy protein isolate, maltodextrin, invert sugar and high fructose corn syrup.". By contrast, skim milk (as used in the unprocessed menu) has nothing added, only removed, and so would fall under their Group 1 "unprocessed or minimally processed foods".

As for whether this is actually a useful classification system, I don't know. I have no reason to believe any of the studies are bogus, but taken as a whole, it does seem like an attempt to launder the naturalistic fallacy into some scientific respectability.

[0] http://archive.wphna.org/wp-content/uploads/2016/01/WN-2016-...

[1] https://news.ycombinator.com/item?id=19930970

[2] https://www.nestlehealthscience.us/brands/nutrisource/nutris...

Pete_D··on How streaming is changing songs
Idle thought: if musicians are being slowly replaced by algorithms, the future might not look like streaming individual tracks, but like apps that generate an endless amount of music locally. I think there'd be demand for such a thing from people who just want something on in the background. Possibly currently supplied by the four-hour or longer sets of electronic/classical music one sees on YouTube.
Pete_D··on Face transplant recipient’s donor face now failing
How much of this is mitigated by donor/recipient compatibility (haplotypes? is that the right word?)? Is there no such thing as a purely compatible donor?
Pete_D··on Unprotected database exposes sensitive data of over 20M Ecuadoreans
According to the zdnet report (https://news.ycombinator.com/item?id=20984119, https://www.zdnet.com/article/database-leaks-data-on-most-of...), yes: "The bigger number comes from duplicate records or older entries, containing the data of deceased persons."
Pete_D··on The Man Who Guards America's Ketchup
(disclaimer: I'm not a lawyer, I just have too much time on my hands). It seems that the EU regulations distinguish between additives, enzymes, and flavourings, and that sweeteners fall under additives.

Regulation on additives includes sweeteners alongside colours, emulsifiers, etc: https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:32...

Regulation on flavourings excludes sweeteners: https://eur-lex.europa.eu/legal-content/EN/ALL/?uri=CELEX:32... (2. This Regulation shall not apply to: (a) substances which have exclusively a sweet, sour or salty taste;)

Pete_D··on Effects of short-term fasting on cancer treatment
Other commenters have given the 24-60 hours figure, but it's also worth seeing the section "From animal models to the clinic": "may also mean that humans need to fast for a (much) longer period of time than mice to obtain the same benefits".
Pete_D··on Cool but obscure X11 tools
Not sure if it counts as obscure, but to add to the note on xclipboard: xclip, which lets you change and inspect the primary selection/clipboard from the command line.
Pete_D··on Cool but obscure X11 tools
For data visualizations I use gdb's Python API. For simple things that can be just adding pretty printers, for hairy things it can be a custom command that prints extra information or dumps it to a graphviz script.

https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html

Pete_D··on America’s social-media addiction is getting worse
> The bill would limit social-media usage to half an hour a day (users would be able to bypass the limit by adjusting their app settings).

The Economist is putting it mildly. The Act is quite short and accessible, so well worth reading directly: https://www.hawley.senate.gov/sites/default/files/2019-07/So.... More on that half an hour limit, from Section 4 (paraphrased):

- Opt-out 30 minutes a day time limit

- The time limit gets reset every month, so you have to keep opting out

- A nag pop-up at least once every 30 minutes showing how much time you've spent there that day

If this passes, using the (US) internet will become much more annoying.

(Section 7, which says the FTC gets to make up new rules later, looks a bit suspicious to me too, but I'm not clear on the degree to which that's just standard operating procedure for American politics.)

Pete_D··on Browser tabs are probably the wrong metaphor
I daydream sometimes about having a browser where tabs behave more like buffers in vim or emacs - that is, with no tab bar or particular ordering on open pages, but with them just hidden in the background, with some kind of about:pages interface (like emacs ibuffer-mode) where I could sort/filter them and bring individual ones back to the foreground.

(Split panel view would be nice, while we're at it.)

Pete_D··on The Future of the Operating System: Revisited, Part 1
Eventually, people will get tired of drawing pictures of houses and shopping trolleys, the glyphs will become increasingly simplified and abstract, and we'll finally have Yingzi. https://www.zompist.com/yingzi/yingzi.htm
Pete_D··on Unicode programming, with examples in C
I've seen many distros provide a unicode-data package, containing the human-readable text files from the Unicode Character Database. These are sometimes handy to have around, but I'd be surprised if much software used them directly.
← PreviousPage 3 of 8Next →