Blocking Your Own Damn Distractions

Since college I have stayed up pretty late and gotten up late. My wife generally goes to bed around 10 or 11, and I am more in the range of 12 or 1 AM. However, the past few months I had some worse sleep hygiene. I was staying up late reading random stuff on the internet, or worse, watching Netflix or even video game streams. I would tell myself that I could go to bed at the next half-hour increment, and then blow through that. It would generally take me some time to fall asleep because I had watched something interesting, thought about engaging things, or just been exposed to a lot of light. My sleep quality would be worse than if I had done non-stimulating activities before bed. The next morning I would wake up and be annoyed that I had wasted that time. The next day I would be pretty wiped and irritable.

The process was a bit cyclical. I would stay late at work because I had gotten in later, and then it would be dark. I would be less likely to exercise and had a lot of energy at night. And on and on.

Taking charge

I realized that something had to change.

My plan was to commit to stop using my computer at around 10 PM. I reasoned that there was nothing that required me to use the computer after that point unless I made poor life decisions. If I truly needed to be on the computer, I either put things off too much or had an emergency that better engineering or planning could fix.

My hypothesis was that if I didn’t have the internet, I would either need to do useful things locally or would turn the computer off completely out of boredom. I don’t have many interesting things to do besides write words, read longer form content, write programs (using the Dash program as an offline lookup), or do spaced repetition when I don’t have a connection. I looked for a program that would try to turn off my internet completely at a certain time. It seemed that the solutions that I found for doing something like this had one or more negative qualities:

  • cost money and didn’t quite have the features I wanted
  • were irrevocable (could not get the internet back, even after a reboot)
  • didn’t have scheduling of blackout periods
  • only blocked portions of the internet, not everything

Rolling my own

A Macbook Pro is my primary rig. My first thought was to make a Mac program that would manage all of this. Then I figured that I could run some automated recurring tasks to try to achieve the same result. Typically one would use cron, but since I have a local Jenkins server, I can run Jenkins tasks to get a better interface and more visibility into the job runs.

I have three tasks set up in Jenkins:

  1. The first task is called “Warn wifi turning off”. It warns me that the Wi-Fi will be turning off at 10 PM. It does this by invoking the Mac command say to audibly warn me of this fact. Pretty simple:

    /usr/bin/say "The wi-fi is turning off at 10 PM!"
    

    It runs at 9:50, 9:55, and 9:59 (50,55,59 21 * * * in cron syntax.) It could be potentially improved by flashing a system message in the upper corner in case the volume is down, but works fine.

  2. The second task is called “Turn wifi off at 10 PM and every five minutes”. This script does not mess around. It turns off my Wi-Fi every five minutes from 10 PM until 5 AM. This is to prevent me from just turning the Wi-Fi back on. It is also quite simple:

    sudo /sbin/ifconfig en0 down
    

    This just says to take down the wi-fi interface through a command-line command. The interval is: 0,5,10,15,20,25,30,35,40,45,50,55 0,1,2,3,4,22,23 * * *.1

  3. The last task is called “Turn wifi on at 5 AM”. It does the opposite of the command above:

    sudo /sbin/ifconfig en0 up
    

    It runs at 5 AM (0 5 * * * in cron syntax.)

The set up is slightly buggy at the moment–the Wi-Fi usually doesn’t turn back on in the morning, for instance, so I have to invoke the script manually. Also, I’ll sometimes be greeted with “The Wi-Fi is turning off at 10 PM!” when I open the computer in the morning if I had it closed before 9:59 PM. But these are acceptable issues.

The result

So far I don’t think that I stayed up late dicking around on the internet once since I’ve set it up. I’ve only disabled it to watch a movie with my wife in the evening on her birthday, and then promptly re-enabled it.

I take the 10 PM deadline much more seriously than if I had to think about it every day. I’m sure that I would see the deadline come and go and not think twice about it after a few weeks. I think this is an example where a little willpower in setting up a system pays dividends down the road. A few times I’ve heard that the Wi-Fi is going to shut off and hurried to finish any tasks that needed the internet. Usually some time shortly after 10 PM I do get bored and do other things or simply go to bed.

Now I am getting more sleep and starting on a more positive spiral.

Another positive belief that I’ve come to realize: if there’s something worth consuming on the internet, it will be there tomorrow. Tomorrow I’ll be more awake, alert, and able to assess whether this thing is worthy of my time. But today, I can be safe in the knowledge that if there is something great, it’ll be there tomorrow and to not need to “complete” things (are they ever really complete?)

What distracts you?

What are your bad habits, and how could you set up a system to try to corral them?


  1. Technical note: Given my username is anthony, I did need to add /sbin/ifconfig for my user to the sudoers list. I did a sudo vi /etc/sudoers and added: anthony ALL=NOPASSWD: /sbin/ifconfig 

Categories: main

« Splitting and Joining Code Blocks With Vim Resolving Jekyll 3 Draft Issues »

Comments