Chris Irwin

Thoughts and Ramblings

Using devtodo with multiple projects

I’ve tried (and failed) to use many different pieces of software designed to manage todo lists. The main reasons I’ve failed is because the software either has a high learning curve, bad documentation, or it is cumbersome to use.

I’ve finally struck gold with devtodo. Out of the box, it is almost perfect, but there are a few little issues:

  • It expects .todo in the current directory
  • It has no ability to track what you are working on.

I’ve managed to work around both of those with some extra functions in my .bash_profile.

Where is my .todo?

I wanted a git-like approach to my todo list. If there is not one in the current directory, check the parent, the grandparent, etc. Eventually, fall-back to ‘Global’ todo list in ${HOME}.

Note: This depends on the rfind function in my previous post.

First, create a function to set the TODO_FILE variable. We’re going to set TASK_FILE here as well, this is referenced further down the page.

set_nearest_todo_file()
{   
    ntdf_file=$( rfind -name .todo -type f )
    if [[ -z "${ntdf_file}" ]]; then
        ntdf_file="${HOME}/.todo"
    fi  
    TODO_FILE="${ntdf_file}"
}

set_nearest_task_file()
{
    TASK_FILE="${TODO_FILE}-current"
}

Now, we need to call these on cd, pushd, and popd, as well as when the shell is sourced.

cd()
{
  if builtin cd "$@"; then
    set_nearest_todo_file
    set_nearest_task_file
  fi  
}
pushd()
{
  if builtin pushd "$@"; then
    set_nearest_todo_file
    set_nearest_task_file
  fi
}
popd()
{
  if builtin popd "$@"; then
    set_nearest_todo_file
    set_nearest_task_file
  fi
}

set_nearest_todo_file
set_nearest_task_file

Next, lets make an alias for td to call devtodo with our desired todo_file

td()
{
    # Don't print DB notice for .todo in current dir
    if [[ "${TODO_FILE}" != "./.todo" ]]; then
        # Output DB notice to stderr.
        # so we don't mess with output parsers
        echo "Using database ${TODO_FILE}" 1>&2
    fi
    # Specify found DB
    devtodo --database ${TODO_FILE} $@
}

Now, when we call td, we will be referencing the nearest TODO_FILE, either in the current directory, one of it’s parents, or falling back to ${HOME}.

What am I working on?

This was simple enough. devtodo has aliases for todo (devtodo), tda (todo —add) and tdd (todo —done). We also added td above. I’m going to hijack tdd, and add a new ’t' command to set a current task.

We already added the neccessary parts to get TASK_FILE above. Now we’re just going to create a function to set a task in that file.

t()
{
    if [[ "$*" == "" ]] ; then
        if [[ -f "${TASK_FILE}" ]]; then
            cat ${TASK_FILE}
        fi
    else
        td $@ | tee ${TASK_FILE}
    fi
}

You’ll notice that if we call t with a parameter, such as t 6, it run td 6, instruct td to show task 6, and copy that output to your TASK_FILE.

If we simply call t, it will cat out our TASK_FILE to the screen.

I’ve also hijacked tdd, the devtodo ‘done’ alias, to clear my TASK_FILE as well.

tdd()
{
    /usr/bin/tdd $@
    rm ${TASK_FILE}
}

My workflow

I find this very easy to manage. td to review my list, t # to select my active task, and t while I’m working to be reminded what I’m doing. The task number is still in the output of t. When I’m done, tdd # marks that task as complete, removes TASK_FILE, and I’m free to start another task.

Posted 1 month ago
Loading mentions Retweet

Reverse Find

I recently had need to do a reverse find, and couldn’t discover any programs that offer this functionality. I decided to work around the issue using a bash function, loops, and find.

This function can be stuffed into your ~/.bash_profile, and referenced wherever you need it.

rfind()
{
    rfind_path="${PWD}"
    while [[ "${rfind_path}" != "/" ]]; do
        rfind_search_paths="${rfind_search_paths} ${rfind_path}"
        rfind_path=$(dirname "${rfind_path}")
    done

    find ${rfind_search_paths} / -maxdepth 1 $@ -print -quit
}

As an example, let’s say I’m in /home/user/docs, and I execute rfind somefile.txt. rfind will actually build a command and execute the following:

find /home/user/docs /home/user /home / -maxdepth 1 somefile.txt -print -quit

This will find the nearest parent directory containing a file called ‘somefile.txt’, and quit after printing the first (nearest) match.

Edit: Updated rfind to use a much simpler ‘dirname’ method.

Posted 1 month ago
Loading mentions Retweet

the iPad letdown

Okay, so the ipad is just a big ipod touch, and filling the "device too large to always have on you but too limited to do lots with" between a handy with-you smartphone and a real computer. If it was an accessory to a computer, THEN it would be interesting. Put it on the dock and it acts like a second screen. If you're reading a PDF or web page, you can send it to the ipad for display, grab the ipad and continue having your reference material up. How about an example:
  1. I look up "How to do XYZ on some obscure server issue" on my computer. I do this on my computer because it takes a long time to find what I need.
  2. I read through until I find the helpful bit on page 322 of a 700 page pdf.
  3. I send that to my padd and walk to the server room where I can follow the instructions
  4. Note there was no step for manually copying a file, bookmarking, manually opening on the padd, remembering I want p322, etc. Just drag send it to the padd (whether it's a drag, a click, whatever).
For inspiration, see interesting UI interaction done on Science Fiction. Star Trek has had accessory "padd" devices that acted this way. Minority Report had this as well (which was mostly un-noticed next to the gesture UI everybody did happen to notice). Until that device comes out, I see no need for a cell phone that can't make calls, or a computer that can't run software.
Posted 7 months ago
Loading mentions Retweet

For Twits and bookfacers

I've linked my blog to Twitter, Identi.ca, and Facebook via ping.fm via CR Post2Pingfm Twitterfeed. Whew. Hopefully this means that I will update my blog more often as there is a slight, remote chance that somebody might actually see it. I've got two LUG presentations coming up: DIY debian packaging for LOLUG and KVM+libvirt for KWLUG. I'll post slides when I present. Update: I've decided to use twitterfeed instead of the wordpress plugin I was using. It manages to post a little nicer to facebook. The only down-side is it is a timed rss-pull mechanism instead of a nice push, but I'll live.
Posted 8 months ago
Loading mentions Retweet

imagecompare

I've created a new project called imagecompare. The purpose is to detect and merge duplicate images, particularly where EXIF information may differ. There is more information on the project page
Posted 10 months ago
Loading mentions Retweet

Git

I've recently switched over to using git for revision control for my personal projects. This has made doing packaging and development substantially easier. I also decided to use git for my resume. I've redone my resume in LyX (a LaTeX front end) r
Posted 11 months ago
Loading mentions Retweet

My Ubuntu PPA packages

I have a PPA on Launchpad.net now. I've found it substantially easier than managing my own repository. Apparently some other folks use it, so I will be posting here when I do notable updates and additions. Here is a breakdown of what is on there now:
  • cwi-meta and the cwi-* packages it builds. These are packages that provide PPA repository information and package dependencies for me setting up new (virtual) machines. One apt-get and I have my expected environment.
  • libvirt, virt-manager, and associated packages. I'm keeping these up to date for Intrepid as I am using them with kvm/qemu.
  • cwi-vm-builder. A wrapper around ubuntu-vm-builder. When compined with an apt proxy/cache, it can bootstrap a VM in about 2 minutes. This is my standard vm template so I can build a new VM in a single command.
  • task & yagtd. Two unrelated gtd-style task managers. I reccommend trying them out.
If you use my PPA, feel free to contact me with suggestions and issues. I can't fix anything I don't know about. Also, launchpad does not give any statistics on PPA useage, or download history. It would be nice to get a rough count of the number of users using my packages.
Posted 1 year ago
Loading mentions Retweet

Bulk Import

I have imported content from my previous Wordpress blog (It was MIA for a bit). Pretty much everything older than this post is obsolete.
Posted 1 year ago
Loading mentions Retweet

Things to remember

Here are some interesting links to keep handy. I do not think these are easy enough to come across, so I'm linking to them from here.

* How to get windows to use a hardware clock set to GMT. You know, like the rest of the world.

* How to grab the i-sight firmware for use with Linux. Note that the kernel in Ubuntu Feisty already has the driver part.

* Some Ubuntu email server tips.

Loading mentions Retweet

Some "Free to a good home" stuff

I have various pieces of computer equipment that I am looking to get rid of. I would much prefer to give them to somebody who can put them to a useful purpose rather than throw them out. Please contact me if you are interested. I'm listing all components separately. While several are currently attached (motherboards + cpus) I am willing to divide up this stuff however necessary. Free Stuff
  • Motherboards + CPUs
    • 2 1 - 1.2GHz AMD Athlon (Thunderbird) CPUs
      • Need heatsinks, probably around $20 nowadays.
    • 1 - 1.0GHz AMD Duron CPU
    • 2 1 - MSI Motherboards
    • 1 - FIC Motherboard
  • Optical Drives
    • 1 - 52x32x52 CD ReWriter/16x DVD-ROM
    • 1 - 48x16x48 CD ReWriter
    • 1 - 4x4x?x IDE CD ReWriter
    • 1 - ?x DVD DVD-ROM (unsure of speed)
    • 1 - 6x IDE CD-ROM
    • 1 - 24x CD-ROM
Not Free Stuff
  • 1 - Apple iBook 12"
    • 1.07GHz G4
    • 768 MB Ram
    • 40 GB Hard Disk
      • I'll throw in the original 30GB Hard Disk, but it is not easily changeable.
    • 32MB ATI Radeon 9200
    • 1024x768 display
    • Fancy Slot-loading CD ReWriter/DVD-Rom
    • Airport Express (802.11b/g)
    • Brand-new battery
      • Just had the battery replaced through an Apple product recall, so this battery has full capacity.
    • OS X 10.4 + Original 10.3 Disks
    • Fancy metal briefcase (It is actually multi purpose, I packed it with cut-out foam)
    • Runs Linux extremely well, but it currently has only OS X on it. I'd be willing to install Ubuntu on it if desired.
Loading mentions Retweet