Josh Thompson     about     archive     turing     office hours

Notes from 'Why We Sleep'

I first read Why We Sleep: Unlocking the Power of Sleep and Dreams about two years ago. It immediately led me to prioritize sleep over almost everything else.

Most of us don’t get enough sleep, and are worse for it. Usually when the topic of sleep comes up, I say

Hey, there’s this great book I read on sleep. You should read it, and then sleep more…

The people most in need of more sleep are also usually the people most unable to make time to read a book about sleep. So, here’s an effort to help these people save time, prioritize sleep, and then maybe give the book a read anyway.

I hope to use this post to accomplish two things:

  1. Convince you that sleep is massively important and you should sleep more
  2. Convince you to read the book. If you find anything below compelling, you’ll find it even more compelling if you read the whole book yourself.

Everything that follows is a quote from Why We Sleep.

If I add my own comments, they’ll be inline and italicized, like this:

Josh: here’s a comment I’m adding


I’ve quoted from this book, extensively. I don’t recommend reading this post top-to-bottom, but rather jumping around the post, from this following index, to a section that looks interesting, then going back to the top, jumping to a different section, etc.

Quotes from Why We Sleep:

Two-thirds of adults throughout all developed nations fail to obtain the recommended eight hours of nightly sleep.

This is the grab-bag of negative impacts on sleeping too little. From the first chapter. The author expands on all of these points later in the book.

  • Routinely sleeping less than six or seven hours a night demolishes your immune system, more than doubling your risk of cancer.
  • Insufficient sleep is a key lifestyle factor determining whether or not you will develop Alzheimer’s disease.
  • Inadequate sleep — even moderate reductions for just one week — disrupts blood sugar levels so profoundly that you would be classified as pre-diabetic.
  • Short sleeping increases the likelihood of your coronary arteries becoming blocked and brittle, setting you on a path toward cardiovascular disease, stroke, and congestive heart failure.
  • Fitting Charlotte Brontë’s prophetic wisdom that “a ruffled mind makes a restless pillow,” sleep disruption further contributes to all major psychiatric conditions, including depression, anxiety, and suicidality.
  • Perhaps you have also noticed a desire to eat more when you’re tired? This is no coincidence. Too little sleep swells concentrations of a hormone that makes you feel hungry while suppressing a companion hormone that otherwise signals food satisfaction. Despite being full, you still want to eat more. It’s a proven recipe for weight gain in sleep-deficient adults and children alike.
  • Worse, should you attempt to diet but don’t get enough sleep while doing so, it is futile, since most of the weight you lose will come from lean body mass, not fat.

Add the above health consequences up, and a proven link becomes easier to accept: the shorter your sleep, the shorter your life span.

The old maxim “I’ll sleep when I’m dead” is therefore unfortunate. Adopt this mind-set, and you will be dead sooner and the quality of that (shorter) life will be worse.

>> Read more

How I take notes, AKA 'Add an Index to Your Notebook'

A while back, sometime in 2017, I wrote this tweet:

Since then, I occasionally have conversations with people, about how we all handle taking notes in physical notebooks. Rather than wrestling with a web browser to find this one specific tweet, I’ll just drop everything I have to say on the topic into this post.

After encountering this “indexing” method, I’m a firm convert to the value of organizing paper notes in this fashion. It helps me get very dense notes in my notebook, and it’s easy for me to organize my notes by topic, rather than in chronological order.

Here’s my current stash of “indexed” notebooks:

image of an index All of these notebooks are full of notes, and they’re all indexed.

Mostly, I talk about indexes with Turing students, getting ready to dive deep into technical topics. A single lesson might reference a new keyboard shortcut for their code editor, a novel way of using Git, several new methods in a given programming language, and more.

Rather than stick all of those on a page marked with the current date (and being unable to quickly look up the Git commands next time I break something with it) I’d just add each new piece of information to a page specific to the topic.

If I didn’t have a page specific to the topic, I’d flip ahead of the first empty page in my notebook, add the topic to the top of the page, and then add that new topic to the front of my notebook, in the index:

image of an index My very first Turing notebook (this single notebook lasted me about half of the program

Lets dig a bit deeper into the git index item (the very first item, top of the page in the picture)

Each of those small black lines marks another page of notes about Git.

image of an index Here’s ‘git’ the index, and you can see that I have at least four pages of notes on git, scattered throughout my notebook

>> Read more

LeetCode: Words From Characters, and Benchmarking Solutions

I recently worked through a LeetCode problem.

The first run was pretty brutal. It took (what felt like) forever, and I was not content with my solution.

Even better, it passed the test cases given while building the solution, but failed on submission.

So, once I fixed it so it didn’t fail on submission… it then timed out. My code was so inefficient leetcode’s test suite took too long to finish.

I have a few learning objectives for doing this kind of code challenge:

  • Improve my knowledge of Ruby’s API
  • Get better at benchmarking code “snippets”.
  • Refresh/document my “process” for learning new things about a programming language, for the benefit of Turing students who are attacking their own code challenges.

The challenge and my (not quite working) solution.

Here’s the given instructions:

You are given an array of strings words and a string chars.

A string is good if it can be formed by characters from chars (each character can only be used once).

Return the sum of lengths of all good strings in words.

Example 1:

Input: words = ["cat","bt","hat","tree"], chars = "atach"
Output: 6
The strings that can be formed are "cat" and "hat" so the answer is 3 + 3 = 6.

Example 2:

Input: words = ["hello","world","leetcode"], chars = "welldonehoneyr"
Output: 10
The strings that can be formed are "hello" and "world" so the answer is 5 + 5 = 10.


1 <= words.length <= 1000
1 <= words[i].length, chars.length <= 100
All strings contain lowercase English letters only.
>> Read more

Book Notes: 'Why We Get Fat' by Gary Taube

I recently read Why We Get Fat, by Gary Taubes. I read it shortly after reading The Case Against Sugar. My notes and a write-up on The Case Against Sugar

As I explained in that post, I find it helpful to do a ‘deep dive’ on some of the books I want to be deeply influenced by. For a variety of reasons, I have a tolerably high degree of physical fitness. I’d like to retain this fitness for a long time. Much of the fitness equation is “don’t have extra body fat”, so to that end, I’ve been doing reading on the topic.

Given how prevalent being overweight or obese is in our society, the small investment of reading a few books that might point one towards a proper course of action has ludicrously high returns.

Notes on formatting

I will be freely interjecting my thoughts throughout the rest of this review. When I quote the author, it will be denoted like such:

These are words the author has written

Sometimes they’ll extend for several paragraphs

I may choose to italicize or make bold portions of the quotations from the books. In general, these are my decisions, not the author’s.

If there are

[words wrapped in brackets]

it’s me editorializing to load the context of the quote.

My collected notes from Why we get fat: and what to do about it

Getting fat is not a “calories-in/calories-out” problem, or “eat too much, exercise too little” problem. It’s a hormonal regulation problem.

In honor of the laws of thermodynamics that they’re replacing, we’ll call these the laws of adiposity. The First Law:

Body fat is carefully regulated, if not exquisitely so.

This is true even though some people fatten so easily that it’s virtually impossible to imagine.

What I mean by “regulated” is that our bodies, when healthy, are working diligently to maintain a set amount of fat in our fat tissue — not too much and not too little — and that this, in turn, is used to assure a steady supply of fuel to the cells.

The implication (our working assumption) is that if someone gets obese it’s because this regulation has been thrown out of whack not that it’s ceased to exist.

>> Read more

Book Notes: 'The Case Against Sugar' by Gary Taube

In the last few weeks, I read The Case Against Sugar by Gary Taubes.

I found it to be compelling (more on that in a moment) and I want to be impacted by them. I want the daily decisions that I make to be subtly influenced by this author and these books.

Related but in a different vein, Nat Ellison has his collection of book notes. Derek Sivers has his. Patrick Collison has a list of books he recommends. I’ve got my own list of recommended books, but I’ve wanted to dive a bit deeper on some of them. So, like Nat Ellison and others, I’m grab-bagging quotes (helpfully brought over from highlights on my Kindle) and some thoughts interspersed between.

I’ve not settled (yet) on a format I like, but as in most things, this is an iterative process. These notes may be useful to others (at least to help them decide if the book is worth reading) but primarily this is a helpful process to me.

After reading The Case Against Sugar, I read (and did a write-up of) Why We Get Fat: And What To Do About It

Notes on formatting

I’ve included broad quotes from the book; headings, non-quoted text, bold/italicized text, etc all my addition to help with the skimming, unless I indicate otherwise.

The Case Against Sugar

The dominant views of obesity and weight have problems

Starting this out with a strong shot across the bow, Taubes argues that the “modern” understanding about why we get fat falls into two dominant approaches, and both are catastrophically wrong.

Since the 1930s, to summarize briefly, nutritionists have embraced two ideas that ultimately shaped our judgments about what constitutes a healthy diet. These would be the pillars on which the foundation of nutritional wisdom about the impact of foods — including sugar — on obesity, diabetes, heart disease, and other chronic diseases would be based. They were both products of the state of the science of the era; they were both misconceived, and they would both do enormous damage to our understanding of the diet-disease relationship and, as a result, the public health.

The first idea was that the fat in our diets causes the chronic diseases that tend to kill us prematurely in modern Western societies.

At its simplest, this focus on dietary fat — specifically from butter, eggs, dairy, and fatty meats — emerged from a concept that is now known as a nutrition transition: As populations become more affluent and more urban, more “Westernized” in their eating habits and lifestyle, they experience an increased prevalence of these chronic diseases. Almost invariably, the dietary changes include more fat consumed (and more meat) and fewer carbohydrates…

The second pillar of modern nutritional wisdom is far more fundamental and ultimately has had far more influence on how the science has developed, and it still dominates thinking on the sugar issue. As such, it has also done far more damage. To the sugar industry, it has been the gift that keeps on giving, the ultimate defense against all arguments and evidence that sugar is uniquely toxic. This is the idea that we get obese or overweight because we take in more calories than we expend or excrete.

By this thinking, researchers and public-health authorities think of obesity as a disorder of “energy balance,” a concept that has become so ingrained in conventional thinking, so widespread, that arguments to the contrary have typically been treated as quackery, if not a willful disavowal of the laws of physics.

According to this logic of energy balance, of calories-in/calories-out, the only meaningful way in which the foods we consume have an impact on our body weight and body fat is through their energy content — calories. This is the only variable that matters. We grow fatter because we eat too much — we consume more calories than we expend — and this simple truth was, and still is, considered all that’s necessary to explain obesity and its prevalence in populations.

This thinking renders effectively irrelevant the radically different impact that different macronutrients—the protein, fat, and carbohydrate content of foods—have on metabolism and on the hormones and enzymes that regulate what our bodies do with these foods: whether they’re burned for fuel, used to rebuild tissues and organs, or stored as fat.

By this energy-balance logic, the close association between obesity, diabetes, and heart disease implies no profound revelations to be gleaned about underlying hormonal or metabolic disturbances, but rather that obesity is driven, and diabetes and heart disease are exacerbated, by some combination of gluttony and sloth.

It implies that all these diseases can be prevented, or that our likelihood of contracting them is minimized if individuals - or populations - are willing to eat in moderation and perhaps exercise more, as lean individuals are assumed to do naturally. Despite copious reasons to question this logic and, as we’ll see, an entire European school of clinical research that came to consider it nonsensical, medical and nutrition authorities have tended to treat it as gospel.

>> Read more