HNHacker News
TopNewBestAskShowJobs

PeterWhittaker

2,211 karma · joined April 27, 2009

submissionscomments
PeterWhittaker··on tcpulse: A TCP/UDP load generator that provides fine-grained, flow-level control
Any possibility of using it with diodes? I've used iperf for this (two separate instances), but iperf2 doesn't support this. We've also written our own in Rust, tightly coupled to our needs, but if there are better tools out there, well, we'd be silly not to investigate. Thanks!
PeterWhittaker··on Curate your shell history
I opted for a single history across all sessions on any given host: On my main machine, the first of 54,434 entries is timestamped 2020-08-22:12:39, while on the machine on which I do most development at the moment (it varies from product to product and release to release), the first of 34,771 entries is timestamped 2023-05-08:11:34.

For the curious, the salient .bashrc bits are:

  function _setAndReloadHistory {
      builtin history -a
      builtin history -c
      builtin history -r
  }
  
  # preserve shell history
  set -o history
  # preserve multiline commands...
  shopt -s cmdhist
  # preserve multiline command as literally as possible
  shopt -s lithist
  # reedit failed history substitutions
  shopt -s histreedit
  # enforce careful mode... we'll see how this goes
  shopt -s histverify
  
  # timestamp all history entries
  HISTTIMEFORMAT='%Y-%m-%d:%H:%M '
  
  # not the default, we like to be explicit that we are not using defaults
  HISTFILE=~/.bash_eternal_history
  # preserve all history, forever
  HISTSIZE=-1
  # preserve all history, forever, on disk
  HISTFILESIZE=-1
  # record only one instance of a command repeated after itself
  HISTCONTROL=ignoredups
  
  # preserve history across/between shell sessions...
  # ...when the shell exits...
  shopt -s histappend
  # ...and after every command...
  PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; } _setAndReloadHistory"
EDIT: Remembered just after submitting that since I am on MacOS, I ran the command

  touch ~/.bash_sessions_disable
back on August 22nd, 2020, to prevent Terminal from saving per-session information. I've never cleaned out ~/.bash_sessions, suppose I should, but it hasn't been updated since that day.
PeterWhittaker··on Show HN: I wrote a modern Command Line Handbook
One nit: ^D only exits if the cursor is at the beginning of a line. Enter <space>^D and the session remains.

Otherwise, looks good! Use of "env" and proper quoting are strong signals!

PeterWhittaker··on TIL: timeout in Bash scripts
I tend to do something like this. Normally, I wouldn't include the extra jobs calls and extra echo calls, these are just to show what is happening.

  #!/usr/bin/env bash
  
  runUntilDoneOrTimeout () {
      local -i timeout=0
      OPTIND=1
      while getopts "t:" opt; do
          case $opt in
              t) timeout=$OPTARG;;
          esac
      done
      shift $((OPTIND - 1))
      runCommand="$*"
      $runCommand &
      runPID=$!
      echo checking jobs
      jobs # just to prove there are some
      echo job check complete
      while jobs %- >& /dev/null && ((timeout > 0)); do
          echo "waiting for $runCommand for $timeout seconds"
          sleep 1
          ((timeout--))
      done
      if (( timeout == 0 )); then
          echo "$runCommand timed out"
          kill -9 $runPID
          wait $runPID
      else
          echo "$runCommand completed"
      fi
      echo checking jobs
      jobs # just to prove there are none
      echo job check complete
  }
  
  declare -i timeopt=10
  declare -i sleepopt=100
  OPTIND=1
  while getopts "t:s:" opt; do
      case $opt in
          t) timeopt=$OPTARG;;
          s) sleepopt=$OPTARG;;
      esac
  done
  shift $((OPTIND - 1))
  runUntilDoneOrTimeout -t $timeopt sleep $sleepopt
PeterWhittaker··on Show HN: 1 min workouts for people who sit all day
It would be cool to be able to pick a start time and a reminder period: starting at 9am, e.g., prompt me to exercise every 45 minutes, with a defer option.
PeterWhittaker··on Show HN: 1 min workouts for people who sit all day
Does X10 for plank and jogging mean 10 seconds, or get into the position, hold, and return to rest 10 times?
PeterWhittaker··on Show HN: 1 min workouts for people who sit all day
Also, it's lose your streak, not loose.
PeterWhittaker··on Goethe's Faustian Life
> I've never heard of queen Victoria having Habsburg ancestry

AFAIK, the only Hapsburg to come near her throne was Phillip II of Spain, husband of Queen Mary (16th C).

Ah! I just checked, and the article now contains the following: Correction: This article has been updated to reflect that Queen Victoria was of Hanoverian, not Hapsburg, descent.

PeterWhittaker··on Goethe's Faustian Life
> Man has a natural inclination to worship something. For most of human history, that has been the divine/supernatural/metaphysical. Nowadays, rationalism and materialism have become the main objects of worship. But rationalism and materialism do not have answers to the existential questions and crises that humans face.

This paintbrush is far too wide. I think many of us have, at least from time to time, felt something between an inclination and need to worship, and many of us feel that all their lives, but I would assert (and die upon this hill) that many lose that [inclination..need].

Personally, I felt it most strongly in my late teens up until my mid twenties when my questioning of everything was at its strongest and my, uh, personality? resolve? acceptance? not sure... was insufficient counter. Like The Stranglers said, I wish(ed) I was a believer, they spend less time being sad.

Eventually, my mechanistic reductionist self made peace with both the many unknowns and the utter ridiculousness of life. The universe is a cold, harsh place, and even our little goldilocks corner of it has an overwhelming imbalance to it, a ruthless "unfairness", at least when viewed through the lens of a humane equity.

Believing in some greater thing does nothing to resolve or address that, though some take solace in believing in some teleology or ultimate reward. Or punishment.

Neither does anything for me and neither is necessary to my life.

> Similar to Christ saying that "man cannot live on bread alone", man cannot live on materialism alone - spiritual nourishment is a very real and necessary thing.

Hard disagree. You might say that my deep breaths and long stares in the woods are spiritual, but I will respectfully disagree. I do not worship those woods, or the lakes or camping with friends or moments of great discovery or satisfaction, whether there or at work, and I find nothing "spiritual" in them.

I accept and rejoice in their being internal affectations, basal responses, and I am quite happy with my reptilian brain. I don't need any sense of anything external or greater or other to celebrate moments of beauty or discovery or to condemn moments of cruelty and injustice.

Please do remember that there are other very different views of the world.

Materialism and our reptile brains are all we've got. I'm content with that. (Unless and until I watch the news, but that is another subject altogether.)

PeterWhittaker··on Variadic Switch
I find the article very interesting and informative but, honestly, of all of the approaches, I find the basic switch to be the most readable and likely the most maintainable, at least for this case.
PeterWhittaker··on Why our waistlines expand in middle age: aging stem cells shift into overdrive
Bwa ha ha ha ha, no.
PeterWhittaker··on io_uring based rootkit can bypass syscall-focused Linux security tools
True, but even those calls require appropriate permissions, and will fail if the program lacks said perms. (Just to emphasize the point that the original article doesn't provide a means of privilege escalation, nor exploit a vulnerability.)
PeterWhittaker··on io_uring based rootkit can bypass syscall-focused Linux security tools
This isn't a "bypass" (and it certainly isn't "terrifying", as reported on /. and elsewhere).

1. The program can only do what it is permitted to do: io_uring just reduces the number of system calls required - but since it works on file descriptors, you must have already acquired the fd in the correct mode.

2. Some monitoring systems hook into system calls and report when they are used: io_uring and opcodes mean the program can perform actions without being noticed by these programs...

3. ...which can report on the use of the system calls that set up io_uring access...

4. ...and could report on the resuting I/O by other means.

I won’t go so far as to say this is a nothing burger, but it feels close.

PeterWhittaker··on Advanced Shell Scripting with Bash (2006) [pdf]
I will definitely check out the sudo-bash deck, thanks!
PeterWhittaker··on Advanced Shell Scripting with Bash (2006) [pdf]
Great presentation. I've been writing bash for waaaay too long, and, while I nodded and said yup, yup, a few times, I also learned some new tricks, so thank you!

The social graces having been observed, if you were to update this presentation to reflect modern bash, and especially reference variables, what would be your top 3 additions?

(I am a big fan of reference variables. They make it possible to, among other things, do some funky things that would otherwise require liberal use of eval, which I eschew. Figuring out how to ensure that the target of a reference variable was in fact an associative array while running under `set -u` was a trick of which I am proud. Note: what I did works and isn't totally ugly, there may be a better way, YMMV, IANAL, etc.)

Second Q, if you will permit: Given the memory leaks in associative array management that have been corrected over the last several years, what are your thoughts on a) whether or not bash should have ever gone that route, and, potentially more controversially, b) the current state of bash maintenance?

(I'm not going to ask about embedding multiple levels of ${...#...} or ${...#...}, because even if it worked, readability would tend to 0 very, very quickly. I'd rather be repetitive and readable and maintainable. Well. Most of the time.)

PeterWhittaker··on Advanced Shell Scripting with Bash (2006) [pdf]
That. Is. Evil.

Nuke it from orbit, or something like that.

PeterWhittaker··on Intuiting TLS
No, though HMACs can play a role. It was a protocol developed specifically for establishment of secure, encrypted, authenticated, and integrity-protected sessions.

I've been racking my brain trying to remember (rarely accessed memories from ~27 years ago). The basic challenge is that unless authenticity, key exchange, and integrity are managed simultaneously during session establishment, there are attacks possible against whatever was omitted. There was a protocol developed at that time that did all of the above as part of session establishment, but I don't remember it really taking off (IIRC, it was patent-encumbered, and that was an obstacle to adoption).

PeterWhittaker··on Intuiting TLS
Interest article, but overlooks SPEKE, which solves problem #1.

There is another protocol for authenticated and integrity protected key exchange, one that solved both the problem of authenticity and integrity attacks, but I cannot recall it.

Hoping someone else remembers it.

PeterWhittaker··on Val Kilmer, star of Top Gun and The Doors, dies aged 65
The Suzuki Method of violin training, perhaps: https://en.m.wikipedia.org/wiki/Suzuki_method
PeterWhittaker··on Introduction to System Programming in Linux (Early Access)
There are applications where ncurses is still a great approach for a controlled, structured UI, e.g., certain security appliances with complex configurations where web UIs, e.g., are not, by default, permissible.

(I spend a lot of time in ncurses on our appliances. We are looking at a web interface, but it will have to be homegrown and SELinux aware. It's a ways out yet....)

PeterWhittaker··on Rust Any part 3: we have upcasts
If Bar inherited from Foo, Bar would have Foo's methods. So if you implemented Bar for Gum, Gum would get Bar and Foo.

But Bar requiring Foo means that if you want to use Gum in a place that expects Bar, Gum must have both Bar's methods and Foo's methods.

In some cases, you might be able to derive some of those.

PeterWhittaker··on Ogres Are Cool
...as does parfait.
PeterWhittaker··on Stupid Smart Pointers in C
1) 2018

2) I recently discovered the implementation of free_on_exit won't work if called directly from main if gcc aligns the stack. In this case, main adds padding between the saved eip and the saved ebp, (example). I think this can be fixed some tweaking, and will update this article when it is fixed.

I do not believe the article was updated, suggesting that the "tweaking" was far more complex than the author expected...

...which doesn't surprise me, because the overall tone is one of a clever but far-less-experienced-than-they-think programmer having what they think is a flash of insight and realizing thereby they can solve simply a problem that has plagued the industry and community for decades.

PeterWhittaker··on The last decision by the leading thinker on decisions
> But this? Too early.

Part of me understands this sentiment, which I take to be rooted in a feeling that he was of such value and had so much potential remaining that why would he take himself away from us...

...and those last few words were chosen deliberately, to highlight the selfishness and lack of empathy in the actual statement of "too early".

Part of me wants to apologize for suggesting selfishness and a lack of empathy, and part of absolutely does not: He was 90, he watched his wife die from cognitive decline, he may or may not have been declining, he may or may not have felt he had more to offer, but, most importantly, he chose to die when he could still make a choice.

Ultimately, that is the reason I cast any gainsaying as selfishness and/or lack of empathy: You DO NOT know him. I DO NOT know him. We DO NOT get to speak for him.

I loved his work. Despite all the flaws in Thinking, Fast and Slow, it remains an influential work, if for no other reason than it recast how we think about some of its subjects and themes.

Would I have hoped he would do more? Of course! Should he have stuck around because I wanted him to?

No. Period. Full stop. End of story.

The two best parts of euthanasia are grace and choice. He had both: He chose his time, and I expect, like my MIL, he died with grace and dignity.

For almost as long as I had known my MIL, she was in pain and suffered involuntary movements (inoperable benign tumour). When the pain got too bad, she had the plug pulled. She was almost giddy in the hospital, dressed in her favourite outfit, with two of her favourite people (not me, her daughter and grandson), having spent the day before with her love of 70+ years sharing memories and saying goodbye.

She was so happy that the pain would end, so happy to be going out on her terms.

Mourn Kahneman, but do not disrespect him - or anyone else - by second guessing him.

Autonomy and empathy are our greatest assets. We would do well to remember both.

PeterWhittaker··on Sigint in Fiction
The conflation of SIGINT and cryptology makes me doubt the writer's understanding of the field. While cryptography and cryptanalysis have long been important to the field, they are but one aspect. I won't offer a meaningless percentage as to how important they are, but consider the importance of a) traffic analysis and b) meta-data: There are plenty of historical examples of operational decisions being made on the basis of traffic analysis and there is the oft-quoted Michael Hayden's "we kill people based on metadata".

(Then there is my favourite WWII nit: The focus on Enigma, which, while undoubtedly important, pales in comparison to Tunny. The fact that Flowers could build essentially a general purpose computer to crack a cipher based only on its apparent properties is heads-and-shoulders and all other superlatives above Enigma, for which GCHQ had working examples throughout the war. I am not downplaying the importance of the Enigma cryptanalysis work, merely suggesting that Tunny was, in the end, and strategically, far more valuable, especially once telephone communications became harder for OKW.)

PeterWhittaker··on Most IT companies fail to serve security.txt for RFC 9116 in 2025
That website misrepresents the RFC in a way that I can only describe as deliberate and egregious. To quote the RFC itself, "This document is not an Internet Standards Track specification; it is published for informational purposes."

In other words, someone had an interesting and possibly good idea, and did the non-trivial to get it published as an RFC (getting even informational RFCs take considerable effort) and now someone (else?) is trying to misrepresent its status.

As said in another comment, "nothing burger". Also, {click,flame}bait.

PeterWhittaker··on Gödel's theorem debunks the most important AI myth – Roger Penrose [video]
But surely any limits on formal systems apply to informal systems? By this, I am more or less suggesting that formal systems are the best we can do, the best possible representations of knowledge, computability, etc., and that informal systems cannot be "better" (a loaded term herein, for sure) than formal systems.

So if Gödel tells us that either formal systems will be consistent and make statements they cannot prove XOR be inconsistent and therefore unreliable, at least to some degree, then surely informal systems will, at best, be the same, and, at worst, be much worse?

PeterWhittaker··on Gödel's theorem debunks the most important AI myth – Roger Penrose [video]
OK, try this for size, bearing in mind that it is a heuristic argument.

No one can "know", with certainty, the location of any particle. Or, to be slightly more accurate, the more we know of its location, the less we know of its movement. This is essentially Heisenberg/QM 101.

But we see the results of "computation" all around us, all the time: Any time a chemical or physical reaction settles to an observable result, whether observed by one of us, that is, a human, or another physical entity, like a tree, a squirrel, a star, etc. This is essentially a combination of Rovelli's Relational QM and the viewing of QM through an information centric lens.

In other words, we can and do have solid reality at a macro level without ever having detailed knowledge (whatever that might mean) at a micro/nano/femto level.

Having said that, I read your comment as implying that "the human mind" (in quotes because that is not a well defined concept, at least not herein; if we can agree on an operational definition, we may be able to go quite far) is somehow disconnected from physical reality, that is, that you are suggesting a dualist position, in which we have physics and physical chemistry and everything we get from them, e.g., genetics, neurophysiology, etc., all based ultimately on QM, and we have "consciousness" or "the mind" as somehow being outside/above all of that.

I have no problem with that suggestion. I don't buy it, and am mostly a reductionist at heart, so to speak, but I have no problem with it.

What I'd like to see in support of that position would be repeatable, testable statements as to how this "outside/above" "thing" somehow interacts with the physical substrate of our biological lives.

Preferably without reference to the numinous, the ephemeral, or the magical.

Honestly, I really would like to see this. It would represent one of the greatest advances in knowledge in human history.

PeterWhittaker··on Brian Krebs: This Administration Is Completely Compromised
One reason I can guess: measured response (or more) against adversarial actions. Like when someone blows up something of yours so you hit something of theirs. We know that many state agents - and others - are conducting offensive cyber operations against the US, and it may be that defence is not enough.
PeterWhittaker··on Bald eagles are thriving again after near extinction
Canada says "you're welcome". (Quite some time ago US and Canadian researchers worked to trap and transport eagles from northern Canada, where there will still several thousand; those birds helped restore the population in the contiguous states.)

I've not been able to find sources to indicate the bird's conservation status in Canada at that time. As far as I can tell, every mention of the birds being on the verge of extinction should always be followed by "in the US".

← PreviousPage 4 of 34Next →