Feeds:
Posts
Comments

Archive for January, 2010

Books I read in 2009

I used to keep track of what I wanted to read on a piece of paper. What started out as list that could fit on a Post-it, grew rapidly into a few pages. At one point, I typed everything up on the computer. From text file, to other solutions, I finally ended up writing a web application: Booklife.

At the end of 2008, I had just refactored Booklife and I added events. The main purpose of events was to generate an ATOM feed. However, as 2010 rolled around, I realized that all my reading habits were in the database.

Here’s was I came up with:

January

February

March

April

May

June

July

August

September

October

November

December

Notes

All in all, I read 34 books in 2009. At first, I was surprised by how high the number was. Then, I was surprised that I had not read even more. I guess, over time, I’ll have a better idea of how many books I’m going through in a given period of time.

Of those 34 books, 17 are audio books. That was a surprise, I would have thought it would have been less than that. Also: the fact that it’s exactly 50% is a coincidence. I had argued in the past that audio books were increasing my “book throughput”. Sure, if I had not read these books in audio, I might have been able to squeeze in more real books. At the same time, I am not convinced. I fit audio books in contexts where real books are inconvenient: when I’m cleaning, doing the dishes, in transit.

Read Full Post »

For some reason, I’ve been in a dotfiles refactoring frenzy.

Though I’ve posted about my rake script to do completion in bash before, that was a while back and I’ve improved things since.

capistrano: on github

export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}

_check_capfile() {
  if [ ! -e Capfile ]; then
    return
  fi

  local cache_file=".cache_cap_t"

  if [ ! -e "$cache_file" ]; then
    cap -T | awk /^cap / {print $2} > $cache_file
  fi

  local tasks=$(cat $cache_file)
  COMPREPLY=( $(compgen -W "${tasks}" – $2) )
}
complete -F _check_capfile -o default cap

rake: on github

export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}

_check_rakefile() {
  if [ ! -e Rakefile ]; then
    return
  fi

  local cache_file=".cache_rake_t"

  if [ ! -e "$cache_file" ]; then
    rake -T | awk /^rake / {print $2} > $cache_file
  fi

  local tasks=$(cat $cache_file)
  COMPREPLY=( $(compgen -W "${tasks}" – $2) )
}
complete -F _check_rakefile -o default rake

There is very little difference between those 2 scripts. In fact, if it wasn’t bash, I would probably refactor this further …

  1. check that the (Cap|Rake)file exists
  2. generate the cache file if it doesn’t exist
  3. use the cache file to do the completion

“rake -T” or “cap -T” will NOT run again until you delete the cache files:

rm_caches() {
  rm -v .cache_* 2>/dev/null
}

Read Full Post »

Follow

Get every new post delivered to your Inbox.