Tag Archives: tips

assignment alignment in vim

I’ve just been reading some articles about programming vim from Damian Conway. * Scripting the Vim editor, Part 1: Variables, values, and expressions * Scripting the Vim editor, Part 2: User-defined functions The latter has a very useful example. function AlignAssignments() " Patterns needed to locate assignment operators. " let ASSIGN_OP = ‘[-+*/%|&]\?=\@<!=[=~]\@!’ let ASSIGN_LINE […]

find(1) abuse

A colleague wanted to find all the files that end up *.disp or *.frag. Easy enough, right? In the shell you can say *.{disp,frag}. $ ls *.{disp,frag} foo.disp foo.frag$ ls *.{disp,frag} foo.disp foo.frag Except that this doesn’t work with find: $ find . -name ‘*.{disp,frag}’$ find . -name ‘*.{disp,frag}’ Why not? Because braces aren’t globs, […]

Removing Byte Order Marks

I keep getting sent files, which are encoded in UTF-8, but include a BOM. Which is completely unnecessary. Thankfully, it’s pretty easy to remove with vim. Just load up the file and type in :set nobomb (docs for the bomb option) and save. Problem successfully defused!

vim completion

I’ve just found something rather useful in vim: :set wildmode. Normally in vim, you can use TAB to complete filenames. So you enter :e some/ve<TAB> and vim pads it out to :e some/very_long_filename.html. Lovely. But in a directory full of files with similar prefixes, it’s less than helpful. I hit :e acc<TAB> and vim expands […]

Curl Tip

Sometimes when running curl, you need to disable the Pragma: no-cache header it sends by default. It turns out that this is quite easy to do: % curl -v -H Pragma: http://example.com/

My Sysadmin Toolbox

After seeing lots of these at Linux.com recently, I thought I’d try to come up with my own list. I used to be a sysadmin (I’m now a programmer), and I’ve long felt that you really a good set of tools (and to know how to use them) in order to be most productive. zsh […]

MultiTail

I used to use tail -f a lot to follow the end of a logfile, as it was written to. Nowadays I tend to use less +F instead, as it can highlight search terms for you as well. But I’ve just seen multitail. It splits the screen and lets you follow as many log files […]

Reboots for Users

Jamis Buck has a good article on how to run TextDrive and Lighttpd together. It involves switching the Rails FastCGI processes to be managed independently from the web server. Essentially, the Rails FastCGI runners become independent daemons. But what’s really useful is the tip in the first comment. It mentions an obscure crontab feature: @reboot. […]