Press "Enter" to skip to content

Lessons Learned Posts

Printing as PDF to the Mac clipboard

If you use macOS, I have a little script that you might find useful. I use this at least a couple times every workday.

The Mac has great PDF workflow functionality. I will often be editing a document and want to send it out via email (or chat) to others who just need to review it and not edit it. I have no idea if they have the application I am using, so I want it to send it in PDF format so that they can reliably open it. What I usually want to do is to “print” the document as a PDF and then attach that to the email. I used to do this a lot and would then have to clean up and delete the PDF files as I did not need them. Not to mention, there were lots of intermediate clicks and mouse movements to save and then open the intermediate file. What I really wanted to do was to print as PDF directly to the clipboard. Then I just paste into the email or other destination application. That saves a few steps and clicks and mouse movements.

I wasn’t sure how to do this, so I asked on Stack Overflow and received a very useful answer. I put together a script based on that answer and have been using it for over seven years.

I have put the source code up on GitHub. Feel free to make any improvements and send me a pull request.

You can download an easy to install version. Just drag the script into your PDF Services folder. (This is in the Library folder of your home directory, if you don’t use the alias I provided in the disk image.)

To make this even better, I have added a keyboard shortcut bound to ⌘-P to execute this script. So printing the current document to the clipboard takes nothing more than pressing ⌘-P twice. Then I can Alt-Tab over to the destination application and press ⌘-V, no mouse movement or clicking needed. To do this, go to System Preferences→Keyboard→App Shortcuts, and add a shortcut with the exact name “Print as PDF to clipboard”.

Comments closed

Jerks versus Morons

Today I encountered a clerk becoming annoyed with the behavior of a customer. I shared with him a technique that I have long been using in similar situations. It helps me maintain a pleasant attitude. When someone does something inconsiderate and annoying (e.g., as often happens when driving), it is easy to assume that the offender is intentionally being a jerk. Consider instead the possibility that this person is a moron. Once you make this mental leap, you can imagine lots of ways in which everyday activities must be difficult and challenging for this moron.

Think about his confusion as he notices other drivers successfully employ turn signals. He probably has no idea of the purpose of many of the various levers and buttons in his car. That likely causes him ongoing anxiety. It must be rough to be him.

Maybe he does not know that his mobile phone can be used in any configuration other than as a speakerphone. Imagine what other frustrations he must have with technology and the modern world.

You can’t really be mad at a moron, just sympathetic. Instead of giving in to anger, smile and speak more slowly, as you would to anybody with a cognitive disability. Be kind to morons.

Comments closed

CO2 Monitoring

A few weeks ago I ran across a post by someone who claimed that he had improved his productivity by installing a CO2 monitor in his office and opening the window when the reading went over 1000 ppm. There are measured decreases in cognitive function at 1000 ppm and lower. This made me curious, so I bought a CO2 monitor for my home office. The monitor clearly shows higher readings when the doors have been closed for a while. I have had the alarm sound at 1000 ppm when exercising in the same room with it.

Now when I see the reading go above 600, I open a door for a bit. It makes a noticeable difference on the monitor very quickly. I don’t know if it is making me any more productive, but I at least have not felt unusually tired since starting this protocol. It could be entirely psychosomatic, but I will take every benefit I can get while trying to do difficult work.

This has been making me wonder how poorly office spaces and schools are designed for cognitive work. We are at a point in history where we have very well sealed environments with people in them trying to do more cognitive work than ever before. This trend will only continue. Every space housing people should be monitoring CO2 (and probably other attributes, like VOCs) and fixing things where the numbers are too high.

Apparently the UK regulates CO2 in schools. I am not aware of any such regulation in the United States. Here in Florida, primary school students are lucky to be in a permanent building, so I do not expect that any exceptional investment is being made in ventilation.

Yesterday I carried my CO2 monitor around to various meetings in different places (much to the amusement of those with whom I was meeting). Every place I checked was at least 200 ppm higher than outside. In one office, two guys are working in a room that read over 1,500 ppm. I wonder if they would be more productive with proper ventilation.

I wonder how cheaply such monitors can be made. Could they be made small enough to fit in a smartwatch?

Comments closed

Publishing My Genome

I did something which may seem a little crazy right now, but I think a lot more people will be doing it in the future: I published my genome on the web. More correctly, I published the ~1,000,000 SNPs identifiable by 23andMe's v3 array.

There are some folks who have also done this before me in a similar way: Orta Therox, Luis Gustavo, Alexander Kukushkin, Manu Sporny. (See Manu Sporny’s blog post for some good insight. I probably got the idea from him. I have been meaning to do this for a while and I must have read his blog post about it a few years ago).

I am a relatively early adopter of 23andMe, getting my genome first sequenced on April 30, 2013. This was before the FDA stopped 23andMe from publishing their health reports. I was intrigued by the possibility of learning about well known markers for problems such as Alzheimer's and Crohn's Disease. While the FDA was preventing 23andMe from selling health risk reports to new customers, I was grandfathered in for a while and could get to the health reports while new customers could only get some data on genetic traits and ancestry. The health reports are back now after years of collaboration with the FDA, but it is not clear to me how they differ from what was available before.

When I first used 23andMe, some people I talked to about it were horrified at the thought of exposing so much data to a private company. They imagine scenarios such as insurance carriers denying coverage based on a known risk. While I think such concerns are valid, I think the benefits outweigh the risks.

23andMe provides a feature for exporting the raw data of a sequenced genome. One can then use this in tools such as Promethease, osgen, and SNPedia.

Devices for genome sequencing are plummeting in cost. You leave copies of your genome everywhere you go in the form of skin cells, hair cells, and saliva. It does not matter how you feel about the privacy of your genetic data, it will all be visible to anybody who wants it soon enough.

Anybody developing or testing software can use my genome and that of others who have published theirs. I am hoping that more people will do the same and accelerate progress in open source genetic science.

One can buy a commercially available device right now, plug it into the USB port of a personal computer, and start sequencing genes at home. We are close to a crazy future where people can sequence a genome (theirs or that of someone else) at home, with inexpensive equipment. How will that affect places where there are legal restrictions on paternity tests, such as France and Germany? DNA testing is being used to ascertain the provenance of sushi and the pedigree of dogs. What happens when phones can easily run apps that talk to sequencing devices?

How soon before dating involves having software review a potential partner's genome, both for long term health issues and desirability of offspring? One could even take the published (or otherwise documented) genomes of two people and figure out what their children might look like using software specifically designed for this purpose. Charles Sibbald published some proof of concept code of how such software would work.

Will census takers at some point start collecting genetic samples? Will employers require them? Will governments prevent such collection by regulation? Will people be discriminated against or harassed based on their genome? Maybe we will see companies pop up that collect genetic samples, deanonymize them, and sell them to others, like we see for ad networks and license plates.

This could be a terrible idea and maybe I will regret publishing my genome, maybe because somebody figures out a way to target me directly with a personalized disease, maybe because I will suddenly lose my health insurance. I don't think such scenarios are likely. If I live through such a lesson, I will write about it.

Comments closed

Quitting Caffeine

As I write this, I have been off of caffeine for two years. I had my last caffeinated beverage on August 13, 2015. Here are my experiences with quitting caffeine and what I’ve learned:


Almost always, when discussing being caffeine-free, people ask me why. I had a couple of primary reasons. First, I had been consuming caffeine in steadily rising quantities ever since I was a child, starting with Coca-Cola. As an adult, I had settled into drinking coffee in the morning and tea in the afternoon. This adds up to well over 35 years of regular caffeine consumption, resulting in dependence. I was annoyed that I required a large mug of coffee over 20-30 minutes every morning to become sufficiently alert to be useful. Second, I have tinnitus. I hear a constant ringing which impairs my hearing and interferes in daily life. I had read that some people experience an improvement in tinnitus symptoms when discontinuing caffeine. For these reasons I decided to quit caffeine and see how it went.

I wrote above that I haven’t had a caffeinated beverage in two years. That is not quite true. I cheated on the day after Thanksgiving, 2015. It had become an annual ritual for me to enjoy a breakfast of coffee and pecan pie the day after Thanksgiving. That day I had a half cup of coffee with my pecan pie. I’ve since no longer felt the need to have that cup. I still enjoy the smell of coffee and I sometimes get small amounts of caffeine as it is naturally found in chocolate, which I occasionally enjoy.

Dependent on Caffeine?

A reader of this post pointed out that not all people are affected by caffeine the same way. I have had my genome sampled by 23andMe. I have the genes on markers rs4410790 and rs2470893 that indicate a typical reaction to caffeine.

As is well documented, regular use of caffeine by those affected causes dependence. The body learns to tolerate caffeine, which blocks receptors of dopamine and norepinephrine. The body generates more of these stimulant chemicals in order to compensate. One needs to gradually and continually increase the amount of caffeine consumed in order to experience the stimulant effect. If you are not generally affected by caffeine, you are atypical and wouldn’t have this problem.


Quitting caffeine was relatively easy. I had already been in the habit of drinking a workout supplement every morning (Cellucor C4) in addition to coffee. The workout supplement powder had caffeine in it, so I cut out all other sources of caffeine (coffee and tea). I bought a set of measuring spoons that went down to 1/64 of a teaspoon and gradually titrated my caffeine intake, decreasing it a tiny amount every day for approximately one month. I never suffered a headache or other problem during this period. When I was down to just a little bit of caffeine every day and it was the start of a three day weekend where not much would be expected of me by the world, I quit entirely.

I now use a workout supplement without caffeine. There are very few of these, I’ve found. Pretty much every supplement that gives you some kind of bump has caffeine in it. I have found that my energy level is improved by ensuring that I consume lots of electrolytes.


I have found there are many benefits to having quit caffeine.

  • Energy level: I find my energy level to be constant from the moment I wake up until very late in the day, near the time I usually go to bed. When regularly using caffeine, I found that my energy level would sag through the day and I would use coffee or tea to compensate.
  • Sleep quality: I find that I fall asleep at night very easily, mostly sleep soundly all night, and awaken refreshed and ready to go with almost the exact same amount of sleep every night (currently ~7.5 hours) and rarely need an alarm clock. When regularly using caffeine, I found that I would sometimes still be wired when trying to fall asleep and it took me a while to become fully awake. I now find that my sleep is only disturbed by having a dessert with sugar or chocolate too close to bedtime.
  • Mood: My mood is very even throughout the day. I no longer experience the occasional grumpiness I felt when undercaffeinated.
  • Morning routine: I enjoy no longer needing a long morning routine to get my head together. I feel alert enough to be useful right when I wake up. I also enjoy being able to brush my teeth immediately upon waking knowing that I won’t need to brush them again after having a cup of coffee. Also, and this may be too much information, coffee has a laxative effect for some people, including me, and I appreciate not having to keep that in mind when planning my morning.
  • Exercise: I used to go through a whole routine of getting caffeinated and fed before doing my daily run or workout. I felt I couldn’t exert myself completely without caffeine. Now I’ve run many 5k races first thing in the morning fasted and without caffeine and know that waiting for my coffee to kick in was just a rationalization and a weakness.

A caveat to all of these points: I also now consume very little sugar, carbohydrates, and alcohol and I meditate regularly. I attribute some of my improvements in mood, energy level, and sleep quality to these other changes and it would be impossible to disentangle the causes and effects.


  • I can no longer compensate for a lack of sleep with caffeine. This has made me much more mindful about getting to bed on time so that I’m not suffering from a lack of sleep the next day. I’ve never been able to nap, so I haven’t been able to compensate with naps. I can now compensate a bit with sugar. I find a little bit of sugar now has a much bigger effect on my perceived energy level. It is hard to tell though how much of this is from having no caffeine and how much is from having very little sugar regularly.
  • There are many social situations in which it is unusual to be drinking only water. I am accustomed to this now, but it was awkward at first.
  • There have been many demanding days in the last couple of years where I felt that if I would just give in and allow myself a cup of coffee, I would get more done. I think overall that this is a false economy though because my energy level would be lower again if I resumed the caffeine intake.


Unfortunately, I experienced no improvement to my tinnitus. I still hear a constant ringing. Sometimes it is louder than others. I expect this to gradually worsen as I get older. That said, I still enjoy the other benefits of being caffeine free enough that I don’t regret quitting.


Occasionally I’m asked if I would like to try decaf instead. I’ve decided to avoid decaffeinated coffee and tea. At first, I avoided decaffeinated coffee because I had read that the decaffeination process involved possibly harmful chemical solvents. I’ve since heard and read that there are decaffeination processes that are not worrisome. Nevertheless, I’m going to stay away. Now that I no longer feel the need for caffeine, the slight enjoyment I get from the flavor doesn’t match the annoyance of staining my teeth and wondering if the beverage had been decaffeinated using water or dichloromethane or chloroform.

Alternative Morning Drink/Supplement

[I added this section after a reader asked what I’m using as a workout supplement that doesn’t have caffeine. At the time I wrote this post, this is what I was taking. I have since discontinued all supplementation except for L-carnitine, electrolytes, and occasional ketones.]

I currently drink a morning cocktail of ketones (1 scoop), L-carnitine (1 tablespoon), BCAAs (1 scoop), and electrolytes (1 tablet). It gives me energy without making me jittery. I find it hard to get the BCAAs without artificial sweeteners on local shelves, so I recommend ordering those. The only component of that cocktail that has calories is the ketones, at 48 calories per scoop. I don’t think the ketones are necessary, but it helps me with running while fasted. I find the electrolytes to be the most important component. I recover after my daily run much faster with them. Unlike with caffeine, I feel I can skip this at any time without ill effect.

I mostly have only one meal a day, dinner, and this carries me through the day as I practice intermittent fasting. While I do not recommend this for everybody, it works great for me.


I intend to stay off of caffeine for the rest of my life. It is too easy to settle into having it regularly and get back on the treadmill of requiring steadily more caffeine every day to maintain the same amount of alertness and productivity. I can easily imagine situations in which I might take some caffeine or other stimulant if I need to stay awake a long time. If I do end up doing so, I will discontinue as quickly as possible to avoid becoming dependent again.

If you have trouble with energy level, mood, or sleep quality, I highly recommend that you at least try quitting caffeine if you’ve been using it for a long time. If you have children, I recommend that you discourage them from getting started on it at all. There may be health benefits to having caffeine, but I’m not convinced they have been reported by anybody not trying to sell you some.

If you want to quit, you might try using a caffeinated workout powder like I did. It makes it a lot easier to tightly regulate and gradually reduce your intake, avoiding withdrawal symptoms. Different kinds of coffee have wildly different amounts of caffeine, so it is hard to regulate using coffee. One reader shared that he used migraine medicine containing small amounts of caffeine to wean himself off.

Having been immersed in daily caffeine consumption for most of my life and now out of it entirely for two years, I’m a bit bemused by noticing how much of the economy is centered around it. I see people enjoying a cup of coffee and that is great, but I also see people being annoyed with each other at the drive through at Starbucks to get their morning fix and I’m not convinced that is a good tradeoff.

If you are interested in more discussion of this topic, there are some good comments about this post at Hacker News and Reddit.

Comments closed

External SuperDrive woes

I have a MacBook Pro (“Retina, 15-inch, Early 2013”). I also have an external SuperDrive, revision 2.00 according to drutil. At some point, the MacBook Pro decided that the SuperDrive is “Unsupported”, according to drutil. Lots of people report similar problems. They advise setting a boot-args parameter, mbasd=1, in the NVRAM (by executing nvram boot-args="mbasd=1").

Unfortunately, in order to set boot arguments nowadays one must disable System Integrity Protection by booting into Recovery mode. Armed with such dangerous knowledge, I booted into Recovery mode and disabled System Integrity Protection with csrutil disable, intending to then set boot-args to mbasd=1. However, upon reboot the SuperDrive started working before I changed the boot arguments, so I copied the CD I needed to and went back and re-enabled System Integrity Protection with csrutil enable and rebooted without bothering to modify the NVRAM boot-args parameter. The drive worked briefly after that and went back to the old behavior.

Apparently it doesn’t need the mbasd=1 parameter in order to see the drive. Maybe it does in order to continue seeing it. I have no idea why this is the case. I’m just documenting it for the next person trying to figure this out.

Update, May 19, 2017:

Well, it stopped working again, so I went through the whole dance of going to System Recovery Mode, disabling System Integrity Protection, setting the boot flag, going into System Recovery Mode again, and enabling System Integrity Protection. It seems to work fine now across reboots. I have no idea why, but you should probably just do the same thing.

Update, June 20, 2017:

It stopped working yet again. The boot-args flag is still set, so I have no idea why. I had to reboot into System Recovery Mode in order to read a disc.

Comments closed

Sweat Versus Apple TV Remote

I have run almost every day on my treadmill for the last four years. I have an Apple TV set up in front of the treadmill. This has allowed me to watch a lot of movies, television shows, documentaries, and TED talks while getting my run in. One thing I didn’t expect to happen is that I effectively ruined the remote to the Apple TV as little bits of salty sweat accumulated on it while it sat on the console of the treadmill. The salt has worked it’s way into the buttons, making them unusable.

I paired a replacement remote to the Apple TV. Wanting to keep this one from getting damaged, I placed it in a Ziploc bag along with some silica gel to keep it dry. The remote works fine through the bag. I recommend this for putting an Apple TV in a hostile environment.

An Apple TV remote protected from sweat.

If I figure out how to clean the old remote, I’ll update this post.

Comments closed

Meteoric Descent

Every time I read the phrase “meteoric rise”, I think about how it is a dumb metaphor because when we see meteors, they are falling towards the Earth. We should instead use “meteoric descent” as a metaphor for things that dramatically catch fire and plummet to Earth in a violent crash (e.g., Theranos).

I wondered when it started being used as a phrase. According to Google’s Ngram Viewer, it really took off in the early 20th century. It is hard to tell where it actually originated as many texts that are found with the Ngram Viewer have the wrong date.

Comments closed

Edward Tufte’s “Presenting Data and Information” Course

This week I had the pleasure of attending Edward Tufte’s one-day course, “Presenting Data and Information” in Miami.

I’ve followed Tufte’s work for years. This was the first time I was able to make it to one of his courses, so I jumped at the chance.

There were at least 200 people in my session. I was expecting a smaller turnout, but I was not surprised. There is a lot of interest in Tufte’s work. I happened to sit next to Matt Lavoie who had likewise driven down from Orlando just to attend the course.

The fee for the course included copies of four of Tufte’s books: “Visual Explanations”, “Envisioning Information”, “The Visual Display of Quantitative Information”, and “Beautiful Evidence”. We were given an hour of “study hall” to read specified passages in these books before the lecture.

Tufte did an excellent job of presenting. He is a seasoned lecturer and he makes it a pleasure to learn from him. Indeed, a bit of the “study hall” reading described a presentation as a performance and explained the benefits of treating it as such. He took complete control of the environment, unobtrusively having his assistants raise and lower the lights as appropriate, for example, when he wanted us to look at the big screens versus when he wanted us to read long in a book. He used video and music in addition to static displays in ways that were useful, not gimmicky.

One thing surprised me early in the reading. It is stated on page 50 of “Envisioning Information” that the bandwidth of the optic nerve is approximately 10Mbps. There is a reference to “How Much the Eye Tells the Brain” (Koch et al., 2015). I had long ago read a statement by John Carmack that the optic nerve only carries around 57kbps, which was the top speed of dial-up Internet access (57.6kbps) at the time. The interesting point I took away from Carmack’s statement is that once we have a way to inject data directly into the optic nerve, all of the advances in pixel pushing of the last few decades will be obsolete. There will be no need to push enormous amounts of data into the eyes as pixels only to have the retinas filter this down to a very narrow stream of information. Nevertheless, once I got over the initial shock of the fact I’ve been carrying around for years being wrong, the difference between 10Mbps and the bandwidth consumed by modern screens (a DisplayPort 1.3 cable carrying 5K content is pushing 26Gbps) is so huge that the point still stands.

I was a little disappointed to have some of the time spent on topics I had already read about from Tufte including admonitions against using PowerPoint, the utility of sparklines, and the beauty of Minard’s diagram of Napoleon’s March. That said, I benefited from another lecture about Minard’s diagram and I don’t know how he would have tailored his course to accommodate the things that the audience has already learned from him outside of the course.

There were a few little nuggets that I thought especially noteworthy:

  • He made a good point about using scrolling navigation to reveal more detail. This has become de rigueur in online publications such as news sites. It seems a lot more effective at allowing people to dive only as deep as they want to in an article or data set. It’s something to think about when building user interfaces to data.
  • He made a point about how cartography is a great example of design “deweaponized” (that wasn’t his wording, it’s how I interpreted it) from the needs of advertising. Many discussions about design are in the service of advertising, which is inherently attempting manipulate the reader. Cartography uses great design to maximize the information presented to the reader without attempting to manipulate (other than obvious examples where maps combine political areas and may attempt to contrast them). He pointed out the details in some maps and how they serve the user.
  • One point made about the rise of multitouch screens is that they allowed user interface designers to reclaim screen real estate that had previously been consumed by scroll bars. I had never thought about that.
  • He had a good example of using video for data analysis. He had a very sophisticated shot of a soccer goal that showed the locations at various points in time of the key players and the ball. It used varying opacity to reflect locations in time. This seems a great way to add a time dimension to visual content.

If you are doing anything with representing data, I consider it well worth the money and time and highly recommend it.

Comments closed

Historical Narrators

Baidu Research have published a paper about their work using neural networks to build a better system for converting written text to audible speech. This is really neat. Listen to the samples in the summary. It is trained on audio files of recorded human speech correlated with written text.

Today, one has two options for listening to a book: One can listen to an audio book expensively narrated by a human or have your computer convert the text to speech automatically, which is currently of very poor quality. Tomorrow, we should have high quality computer narration which will be pleasant to listen to.

A step after that, one should be able to take a descendant of this technique and train it on historical figures for whom we have audio recordings (e.g., John F. Kennedy, Winston Churchill, Ernest Hemingway) to have it speak like them. One could have Churchill narrate his books or those of others. I look forward to hearing a simulation of Ernest Hemingway narrate “The Old Man and the Sea” and JFK reading aloud the works of Doctor Seuss.

Comments closed