HNHacker News
TopNewBestAskShowJobs

Pete_D

1,119 karma · joined November 22, 2013

submissionscomments
Pete_D··on Ask HN: Your favorite syntactic sugar from any language?
Common Lisp's LOOP macro is a fearsome beast.

http://www.ai.sri.com/~pkarp/loop.html

http://www.lispworks.com/documentation/HyperSpec/Body/m_loop...

Pete_D··on Learn just a little Awk (2010)
Note that you can put conditions before the braces, so you can also express the example

    awk '{if ($(NF-2) == "200") {print $0}}' logs.txt
as

    awk '$(NF-2) == "200" { print $0 }' logs.txt
IMO, this style scans easier for most of the grep-ish use cases.
Pete_D··on 82-Year-Old Japanese Woman Finds Success in Coding
Thanks!
Pete_D··on 82-Year-Old Japanese Woman Finds Success in Coding
Do you have a link to that post?
Pete_D··on Blocklist Facebook domains
A lot of commenters mention dnsmasq. I wrote some scripts a while ago to help minimize a dnsmasq config that had been generated from a hosts file. People in this thread might find them useful.

https://petedeas.co.uk/dnsmasq/

Pete_D··on China to bar people with bad 'social credit' from planes, trains
I'm unsure Manna is the best anti-social-credit parable, given that one of the prerequisites for being a member of its utopia is having the government AIs surveil you 24/7 through a brainstem implant. (http://marshallbrain.com/manna7.htm, search for "They watch everything?")
Pete_D··on How exercise in old age prevents the immune system from declining
These kinds of claims when made about fasting are IME usually talking about autophagy. https://www.niddk.nih.gov/news/archive/2013/working-out-heal... is the least shady synopsis I could find. That mainly talks about exercise - for fasting, people seem to be most interested in the mTOR pathway. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3266408/figure/...

I'm not qualified to judge the literature as a whole, and it appears to be an open question whether this can be translated to actionable advice, but we're not in complete bullshit territory here.

Pete_D··on How exercise in old age prevents the immune system from declining
Are you thinking of https://en.wikipedia.org/wiki/Persistent_organic_pollutant ?
Pete_D··on Tell HN: Slack decides to close down IRC and XMPP gateways
I liked Urbit's mapping from symbols to syllables: https://github.com/urbit/docs/blob/master/docs/hoon/syntax.m...
Pete_D··on GDPR – A Practical Guide for Developers (2017)
I would go with "better safe than sorry" if I had to manage this sort of data. It might be fine so long as the URLs are all non-identifying stuff like the Wikipedia home page. But I bet I would have users with much more revealing bookmarks, like, say, their Keybase profile page, or URLs with session/auth tokens in query strings, or the home page of their church which has a congregation of less than 50 people.
Pete_D··on Vim Anywhere
Nothing, but you could add a `vnoremap jk <Esc>` line as well to have it leave visual mode if you wanted.
Pete_D··on Why Japanese web design is so different (2013)
There was an article posted here recently that discussed Chinese font design: https://qz.com/522079/the-long-incredibly-tortuous-and-fasci...

It sounds like while there are a lot of reused components, there's a lot of tweaking needed for it to look right:

> For instance, just have a look at the various uses of the radical 言 (yan, speech). Even in cases where it is in the same position, such as the left half of the character, the stroke weights and shapes are slightly different (the characters shown below are the exact same font and size).

As for input: there are component-based input methods where you would for example type 明 by entering the keys corresponding to 日 and 月, but as far as I know, they aren't very popular. Most people use phonetic input systems where you type e.g. 明 by typing "ming" and picking it from a list (or letting auto-correct do it for you).

Pete_D··on Fuze for Nintendo Switch: An easy-to-learn text-based programming language
Dijkstra had very strong opinions on structured programming, and BASICs in the 70s were very different to today's.

Consider the language reference for Altair BASIC (linked at http://www.swtpc.com/mholley/Altair/Altair_Basic.htm) - almost all of the flow control is by line number references.

By contrast, FUZE (https://fuzebasic.com/bin/FUZEBASIC_Programmers_Reference_Gu...) looks like it has all of the modern affordances you'd expect, like block IF statements, local variables, and the ability to refer to subroutines by name instead of by line number.

Pete_D··on Digital Minimalism for the Working Hacker
Emacs doesn't feel like either a tool or a place to me. If you use emacsdaemon and emacsclient, it becomes not a fixed place you work in, or a completely static tool, but something like a part of the ether you can draw from when needed. There's background state, but much less of the spatial/navigational burdens the author talks about. It's interesting they go on to mention mpd.

I'm not just saying this just to nitpick - I think the stateful daemon concept is a useful extension to the place/tool metaphor and might be a way to achieve the author's desired web browsing experience.

For example, what if web browsers could move tabs to a sort of "invisible window", and there was some shell command like "recall-tab Hacker News" which foregrounded them into a new window? I think something like this might be already possible with something like surf or uzbl and window manager cooperation.

Pete_D··on Using thought to control machines
Thanks for the tip. Do you have any recommendations for good hardware?
Pete_D··on Things I Wish I'd Known About Bash
info works without emacs, but some people prefer emacs' info viewer to the console one. The console viewer does have some idiosyncratic keybindings - for example, "n" means "next node at same level", and "}" means "search for next occurrence". "H" will give you a quick overview.

I'm surprised indexes aren't working for you - unfortunately I don't know of any suggestions to fix that.

Pete_D··on Things I Wish I'd Known About Bash
I don't know if you can locally, but they're often published online in HTML format, like at https://www.gnu.org/software/bash/manual/html_node/index.htm....
Pete_D··on Things I Wish I'd Known About Bash
If foo has a Texinfo manual (GNU tools like bash usually do) then you can try `info foo` and search the index with i or I for -p. Texinfo manuals also have hyperlinks you can press enter on.

info is a greatly underused system and I'd recommend any *nix users to spend some time learning how to navigate it.

Pete_D··on High doses of vitamin D rapidly reduce arterial stiffness
Out of curiosity, I looked up the effects of taking too much vitamin D, and:

> Recent epidemiologic evidence suggests that there is a narrow range of vitamin D levels in which vascular function is optimized. Levels above or below this range increased mortality.[14] Animal research suggests that both excess and deficiency of vitamin D appears to cause abnormal functioning and premature aging.[42][43][44]

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

There's a bigger subsection on cardiovascular disease too, but all I can understand from it is "it's complicated".

Pete_D··on High doses of vitamin D rapidly reduce arterial stiffness
I hadn't seen this before, but it turns out the WHO has a FAQ on it.

http://who.int/features/qa/cancer-red-meat/en/

Pete_D··on Firefox 57 delays requests to tracking domains
I do the same - my approach was to take some of the popular /etc/hosts files (like http://someonewhocares.org/hosts/zero) and sed them into dnsmasq format:

    # before:  0.0.0.0  evil.biz
    # after:   address=/evil.biz/0.0.0.0
    sed 's#^0\.0\.0\.0[[:space:]]*\([^:]*\)$#address=/\1/0.0.0.0#'
which goes in a file in /etc/dnsmasq.d/, with this line in /etc/dnsmasq.conf:

    conf-dir=/etc/dnsmasq.d
The results can be trimmed a lot, e.g. if you have rules for a.evil.biz and b.evil.biz, you can usually reduce those to a rule for just evil.biz. I wrote some scripts to help with this, which are now at https://petedeas.co.uk/dnsmasq/. I might write something up about the process later.
Pete_D··on Firefox is on a slippery slope
Indeed, this is how IceCat works: by taking the Firefox ESR release and sed'ing out things like EME and telemetry.

https://git.savannah.gnu.org/cgit/gnuzilla.git/tree/makeicec...

Pete_D··on Firefox is on a slippery slope
Interestingly, the qutebrowser repo has a list of similar projects: https://github.com/qutebrowser/qutebrowser#similar-projects
Pete_D··on 2017 Was Bad for Facebook. 2018 Will Be Worse
I remember that one. https://www.theatlantic.com/magazine/archive/2017/09/has-the...

> Typically, the characteristics that come to define a generation appear gradually, and along a continuum. [...] I had grown accustomed to line graphs of trends that looked like modest hills and valleys. Then I began studying Athena’s generation. Around 2012, I noticed abrupt shifts in teen behaviors and emotional states. The gentle slopes of the line graphs became steep mountains and sheer cliffs, and many of the distinctive characteristics of the Millennial generation began to disappear. In all my analyses of generational data—some reaching back to the 1930s—I had never seen anything like it.

Apparently it was excerpted from the author's book. I wonder if the book is good.

Pete_D··on Fish: A user-friendly command line shell for macOS, Linux, etc
It's not just to save typing - having an `A=b foo` form built-in instead of relying on an external program means `foo` can be an alias or shell function.
Pete_D··on The Great College Loan Swindle
This is sort of how it works in the UK. You pay 9% of what you earn over £X for 25 years (with X and other details like interest depending on when you started borrowing).

In theory, this stops when you pay off your loan, but the most recent estimate I know of[0] predicts that 60% of graduates under the current system will never get there, so while it's technically a loan, it feels more like a graduate tax.

[0] http://www.telegraph.co.uk/education/educationnews/10747315/... (2014)

Pete_D··on Against an Increasingly User-Hostile Web
On the one hand, I'm afraid that what you describe will eventually become commonplace. On the other hand, I wonder why it didn't already happen during the Flash days.
Pete_D··on Seven habits of effective text editing (2000)
Parent probably meant Kakoune: http://kakoune.org
Pete_D··on Rob Pike's Rules of Programming (1989)
https://www.lysator.liu.se/c/pikestyle.html includes the rules under the header "Complexity", and is dated 1989.
Pete_D··on The design side of programming language design
I can't remember where I first heard it, but I'm sure it was before I'd used command lines. I always thought it came from the little flags on the side of some mailboxes.

etymonline doesn't have an entry for flag as a noun meaning boolean, but this might be related:

> flag (v.2) 1875, "place a flag on or over," from flag (n.1). Meaning "designate as someone who will not be served more liquor," by 1980s, probably from use of flags to signal trains, etc., to halt, which led to a verb meaning "inform by means of signal flags" (1856, American English). Meaning "to mark so as to be easily found" is from 1934 (originally by means of paper tabs on files). Related: Flagged; flagging.

← PreviousPage 6 of 8Next →