A couple tricks I use to keep a work journal and generate daily summaries for my timesheet. Even if you don’t need to keep a timesheet, this is a good way to track your accomplishments. When I was a developer, I had to track my time in quarter-hour increments. I never really liked doing this but, after 10+ years, it’s a tough habit to break. These days, the requirements aren’t quite as strict, but I still keep track of what I’m doing throughout the day. It helps me show others what I’ve been doing and it helps me understand what I’ve accomplished. This can be very valuable, say, during scrum meetings or when I have to fill out my timesheet at the end of the week.


My journal is a simple text file that I maintain in Vim. Each journal entry goes on one line, and each line follows a consistent format. It looks like this:

1995-10-29 04:28 Back from jail! The feds broke my computer, but I think Cereal forgot about the French fry incident.  
1995-10-25 20:47 So, Crash is getting blackmailed. Weird. I gave him some stuff I downloaded from the Gibson and now we are eating pizza.  
1995-10-23 03:32 Righteous hack! I hacked a Gibson and I have proof!  
1995-10-06 23:52 Nikon told me that hacking a bank across state lines stupid, and now I owe Cereal some fries.  
1995-10-04 02:12 Hacked a bank! I'm finally going to get some respect from the guys.  
1995-09-15 18:54 Thinking about a handle. Maybe ULTRALaser?  

As you can see, each line begins with a date and time and includes a short message about, in this example, what Joey Pardella was doing in the Fall of 1995. I write my journal in reverse-chronological order with the most recent entry at the top. I do this, mostly, because that’s where my eyes land when I first look at a document. Unlike Joey, I usually have several entries per day.

So that I’m not writing timestamps manually, I use this mapping in Vim:

nnoremap gs :pu! =strftime('%Y-%m-%d %H:%M')<cr>A<space>

This inserts the timestamp at the beginning of the line and puts me into insert mode. This is handy in other documents, too. When I’m taking notes, I can insert a timestamp quickly. Being able to see these timestamps can be very helpful later on.


At the end of the week, it’s nice to be able to see a daily summary of what I did over the course of the week. For that, I use the following script:

awk '  
BEGIN {FS=" ";ORS="";days=1;prevdt="";msg=""}  
	dt = $1  
	if (dt != prevdt) {  
		if (prevdt != "") {  
			print msg "\n"  
			if (days>5)  
		print "\n" dt "\n"  
		prevdt = dt  
		msg = ""  
	$1 = "";$2 = ""  
	msg = $0 msg  
}' journal.txt | sed 's/  */ /g;s/^ //'  

This gathers up the journal entries for the last five days and prints them out as paragraphs. I can run this in the terminal (Git bash, in my case), or from within Vim. Then I just copy and paste the text for each day into my daily timesheet entry. If you create your journal in chronological order, this script can be simplified somewhat. In my case, because awk processes files top-down, I have to accumulate journal entries, prepending, and then print them after the date changes. If I were to treat this as a normal, chronological log file, my summaries will appear in reverse order within each day; it reads a little weird.