schrierc

Django templates: Accessing dict keys with colons

Earlier this week I was updating a dashboard which uses Django templates. The data included a Python dictionary with a key that contains a colon: data:foo. Normally the dictionary item is accessed using dotted notation such as {{ mydict.foo }} but using a colon results in a syntax error. Exception Type: TemplateSyntaxError Exception Value: Could not parse the remainder: ':foo' from 'mydict.data:foo' The simple fix is to change the key but I don’t own this object and it cannot be easily changed.

Crashing crashplan

I’m evaluating CrashPlan for performing backups of my home computers. It worked flawlessly for my smaller files (Photos, documents) but started crashing when I added my video directory. After a quick search I discovered that the CrashPlan backup service was exceeding its memory allocation. It was trivial to change the allocation from 512m to 1024m: Stop the CrashPlan Backup Service Launch notepad as Adminitrator Edit C:\Program Files\CrashPlan\CrashPlanService.ini Change -Xmx512m to

tmux repeating keys

When upgrading from tmux 1.1 to 1.5 I found a few key bindings changed slightly. In particular, the arrow keys used to switch panes now repeat. I often use the sequence C-b Down immediately followed by Up and then Enter to re-run a unit test. With 1.5 I was doing this too quickly (tmux’s repeat-time is 500ms by default) so I was switched back to my previous pane. To fix

Invalid tmux term causes irssi issues

Today I finally switched my long-running IRC screen session to tmux. I rarely disconnect so I was simply waiting for a “good” time. After a few minutes I noticed that my irssi scrollback was misbehaving; only half of my window would redraw when I pressed PgUp of PgDn. I had manually set TERM=xterm in my bashrc; however, tmux advises only using screen or screen-256color as the term. I have no idea why I had specified term within my bashrc; removing the line and restarting tmux corrected the issue.

irssi autolog options

My favorite IRC client is irssi. I keep a log of my conversations using autolog; however, I dislike logs from chanserv, nickserv, and other random bots which I’ll never reference. I discovered that autolog has a setting to ignore them: /set autolog_ignore_targets chanserv nickserv While searching I also found log_create_mode; irssi’s default file mode is 0644. I prefer to keep my conversations private unless I specifically broaden permissions: /set log_create_mode 0600 Now new messages and channels are private until I chmod them.