Bash Your Day

For the past six months or so I’ve used a bash script to start my morning. The genesis of this idea was that I wanted to be more effective at prioritizing reviewing other peoples’ code and writing my own code. Assuming the number of hours one puts into work is fixed (because that is the only way for life to be sustainable), that means that I need to cut back on other things. The obvious things to minimize are time spent in Slack, on P2s (Automattic’s internal blogs), and time spent being distracted in the middle of the day because I can’t focus for whatever reason.

I decided to adapt the idea of reducing the number of decisions to make inspired a bit by Obama always wearing the same suit to reduce cognitive load. Rather than randomly looking at slack/p2s/email in the morning and trying to navigate how to go from one to then next, all I need to do is start a script, and it walks me methodically through everything I think I need to look at in the morning before I can really get to work coding. Eliminate having to think about what to look at and have some gentle reminders to prevent me from getting stuck doing things that aren’t really that important.

Screen Shot 2016-12-12 at 9.34.27 AM.png

The Script Basics

There are three fundamental functions in my script:
1. i_do_say(): Sends a message to the OS X notifications system and to the say command (advanced usage: speed up the rate and change the voice)
2. timed_msg(): sends a string to i_do_say(), then it waits the specified amount of time. The timer can be interrupted by hitting any key.
3. timed_confirm(): repeatedly calls i_do_say() every X seconds, prompting me to finish up and move on. There is an initial message, and then a second message that repeats indefinitely. I can type ‘d’ to add an extra 5 minutes of delay to the time.

The timed_msg() and timed_confirm() commands can be chained with && so if you cancel out of one then the following commands will be skipped. This makes it easy to have multiple messages in a group, but easily jump to the next thing when you are done. Here’s a good example:

timed_msg "Start five minutes of slack and IRC" 3 &&
timed_msg "Finish slack and IRC in two minutes" 2 &&
timed_confirm "Ready for alerts?" "Does today look like a catch up morning?" 180

I mix these commands along with some others like:

  • Opening a link in my email open https://inbox.google.com/u/0/
  • Closing slack: osascript -e 'quit app "Slack"'
  • Opening emacs: osascript -e 'activate application "emacs"'
  • Starting music: osascript -e 'tell application "iTunes"' -e 'set new_playlist to "Coding" as string' -e "play playlist new_playlist" -e "end tell"

The full repo of my scripts are in https://github.com/gibrown/bash-my-day

I have a reasonably complicated script for my morning with a couple options depending on what I am trying to work on. Some days you just know there is a lot of communication to catch up on, so the idea of quitting slack really won’t work, but my default is to get through Slack/P2s/Alerts/Planning/Meditation in about 30-40 minutes and then close Slack and start on reviewing other people’s code. Optimize for unblocking other people and getting myself to work on writing code (which typically is also about enabling someone else). The morning is also when I am the freshest, so it’s a good time to be coding. Once I get more tired in the afternoon I can get back to closing all those tabs I opened in the morning.

I also have a few other scripts:

  • Ending my day to set myself up for being successful tomorrow (close tabs!)
  • Lunch time I usually eat at my desk, good time to empty email and close tabs
  • A script to get me to close out slack again and get back to coding

Most days I find I only use the morning script. I still need to experiment more with whether the other scripts are helpful.

My Morning

You can see all of this in my morning script, but I thought I would run through my thinking:

  • 5 min: Slack and IRC: if something needs a lot of attention this is usually how I will find out. My main goal here though is to find things that need to be prioritized
  • 2 min: Look at alerts in my email: again, check for any fires
  • 5 min: open p2s, see if there are any I really need to respond to. This is my biggest weakness, ts hard to put off responding until later in the afternoon.
  • 5 min: looking at my to do list and choosing what to work on (all in org-mode in emacs)
  • 2-10 min: Meditation – recently added. it’s ramping up over the next few weeks from 2 minutes to start building the habit up to 10 minutes a day where I’d like to be. The ramp up is all scripted too: see timed_weekly_ramp(). I’ve tried fitting meditation into my day a few different ways before with not great success. I thought this may be good way to build the habit.
  • 5 min: Journal – I do a better job working on the important things if I do some amount of reflection. Recently this has been turning into a blog post which I’d like to make more often.
  • 2 min: write a standup report (2-5 lines) for my team about what I did yesterday and what I’m doing today
  • Music starts. I start reviewing code. Script prompts (repeatedly) me to close Slack. Eventually I do.
  • Move on to writing my own code. Prompt is just to write for 10 minutes. Once I get started I don’t tend to stop. Getting started in the face of distractions is usually the biggest problem.

Last week I also added a few options such as explicitly having catch up mornings when I have been away from work for a few days. Rather than pushing me into coding, those focus on getting me to clean out my inbox, and respond to p2s. Some days it is better to just admit to myself that I need to focus on communication rather than coding.

Results

So what impact did this have? Well, thanks to using Rescuetime to track my time over the past five years I have some pretty good data on that. I have my time broken into 5 categories: Most Productive (coding and code review), Productive (Slack, P2s, email), Neutral (mostly random websites), Distracting (Twitter), and Most Distracting (HackerNews, Talking Points Memo, other sites I refresh too often).

By comparing the past 6 months to the 6 months before that I can more or less see how much having these scripts impacted the percentage of time I spend in each of these categories:

  • Most Productive: up 27.7% (more coding and code review!)
  • Productive: down 14% (yay, less Slack!) Went from being 48% of my time down to 41%.
  • Neutral: down 22.6% (a lot fewer random sites!)
  • Distracting: down 13%
  • Most Distracting: down 9%

These metrics aren’t perfect, since what I work on varies over time. When I’m working on lots of hiring there is a lot more time spent on communication for instance. Its a little hard to correct for variations, but I’ve tried to look at the data for some shorter periods also and I get similar results.

I’m pretty convinced that using a script to push me through the morning both makes me feel more productive, and it does have a big impact on how I spend my time.

Previous Post
Leave a comment

2 Comments

  1. That’s pretty cool.

    Liked by 1 person

    Reply
  2. Proud to have such a geeky friend! I think Danny Reeves would be very interested in this approach as well.

    Liked by 3 people

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: