Sunday, August 19, 2012

Raspberry Pi First Impressions

Received my first Raspberry Pi the other day. I ordered two Model B devices from Newark and, despite the high demand, received them in about a week.

My intended use for the first R-Pi was to serve as a mini-HTPC for my basement TV. I tried both Omxplayer running on Raspbian and Raspbmc. I was very please with the performance of both; they were able to stream videos from my NAS with no issue. Unfortunately mplayer on Raspian currently does not support GPU acceleration on the R-Pi and lacks the horsepower to be of any use. For now, Raspbmc will likely remain the frontend of choice for the HTPC.

Overall, the value of the R-Pi is amazing! For $35, this device is an absolute bargain and a must have for any tech DIYer.

Wednesday, August 15, 2012

Vim Scratch Buffer

Opening a scratch buffer in Vim can come in handy. The following vimrc addition works well: nnoremap <Leader>sc :e scratch<CR>:setlocal readonly<CR>

It is especially useful in combination with the run shell command shortcut once Vim is configured to change to the directory of the current file with the following vimrc addition: autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' ')

The advantage this named buffer has over the [No Name] buffers created by :enew is that newly created scratch buffers will not affect the path of existing buffers. This can be useful if you later want to save the contents of your scratch buffer.

Sunday, August 5, 2012

Vim Run Shell Command

Here is a nice simple vimrc file addition that will execute a line as a shell command and read back the output into the buffer: nnoremap <Leader>rl yy:r!<C-r>"<CR>

Fossil Command Line Tips

For small projects, Fossil is a great choice for revision control. Fossil’s command line interface is very easy to use and plays nice with utilities like grep, gawk and xargs. The following are examples of common operations:
  • Check in only edited files: fossil changes | grep EDITED | gawk '{print $2}' | xargs fossil commit -m "Added feature X."
  • Add only files with name containing "pattern" to repo: fossil extras | grep pattern | xargs fossil add
  • Move files in repo to match move on filesystem: fossil changes | grep MISSING | gawk '{print "fossil mv " $2 " subdir/" $2}' | sh