Displaying all your tab characters in Vim

I usually use :set expandtab in Vim, but a particular file I was editing required explicit tab characters. So I set :noexpandtab, but then realized I couldn’t tell which were tabs, and which were spaces. Easy fix:

:set list
:set listchars=tab:\|\<Space>

…where <Space> is a literal space. Thanks again to the Vim Wiki!

Mulititasking and distraction hurts IQ

That’s interesting.

Dr. Glenn Wilson, a psychiatrist at King’s College London University, monitored the IQ of workers throughout the day.
He found the IQ of those who tried to juggle messages and work fell by 10 points — the equivalent to missing a whole night’s sleep and more than double the 4-point fall seen after smoking marijuana. [Dr. Wilson did not originally make the comparison to marijuana. – eds.]
“This is a very real and widespread phenomenon,” Wilson said. “We have found that this obsession with looking at messages, if unchecked, will damage a worker’s performance by reducing their mental sharpness.
“Companies should encourage a more balanced and appropriate way of working.”
Wilson said the IQ drop was even more significant in the men who took part in the tests.

Reading HTML e-mail with Mutt

Glory be! It’s pretty easy to get nicely formatted output of those sneaky HTML e-mail messages (which all the young Internet kids are sending nowadays).

In your ~/.mailcap, if you use w3m (as I do):
text/html; w3m %s -o display_link_number=1; nametemplate=%s.html
text/html; w3m -dump %s -o display_link_number=1; nametemplate=%s.html; copiousoutput

And in your ~/.muttrc:
auto_view text/html

The Debian Administration site tells you how!

Swedish Man caught splitting atoms in his home

"Richard Handl told The Associated Press that he had the radioactive elements radium, americium and uranium in his apartment in southern Sweden when police showed up and arrested him on charges of unauthorized possession of nuclear material."

Which directories were archived? Command-line

I archived a directory. It took two hours, then exited with a non-zero exit status (that means an error). Hmm — I was just testing something; I only cared if certain specific subdirectories were present in the archive. So I needed a way to look deep inside, quickly, and find those particular directories.

GNU tar will let you “test” an archive with -t, but I only wanted a list of the directories archived. Then I wanted that sorted. So…

$ nice tar -tjvf data.tar.bz2 | tr -s ' ' | cut -d' ' -f 6- | cut -d / -f -2 > tardirs.txt
$ uniq tardirs.txt > tardirs_uniq.txt
$ sort tardirs_uniq.txt > tardirs_uniq_sorted.txt

The -tjvf arguments to tar let you look inside, the “tr” command collapses adjacent spaces so that the first “cut” command will output only the sixth (file) field, and the second “cut” command will reduce a directory like “folder/folder/folder/fun.txt” to “folder/folder.” Then “uniq” will remove non-unique names.

Alternating row backgrounds / conditional formatting in OpenOffice.org

Have you put together an OpenOffice.org table in OpenOffice.org Calc, and wanted to display alternating backgrounds for easy reading? Well, there’s an easy way to do it.

A spreadsheet section showing rows formatted with alternating white and gray backgrounds.

Row backgrounds alternating white and gray 10%

The steps are:

  1. Create a style for every other row and call it “Even rows.” Make its background “Gray 10%,” or whatever other color and attributes you prefer.
  2. In your spreadsheet, select the range of rows you’d like to format.
  3. In the Format menu, click “Conditional Formatting…”.
  4. Choose “Formula is” in the first dropdown.
  5. For the condition itself, enter the formula ISEVEN(ROW()). This formula tests if the current row in question is even or not. If it is, the condition is met and your style is applied.
  6. For Cell Style, select the style you created back in Step 1.
  7. Click OK. There you go.
Dialog box showing formula entered properly in OpenOffice.org.

Your formula should look like this.

Split a file across multiple CDs or DVDs on Linux

Okay, so you very likely have the ‘split’ utility installed (it’s in the GNU coreutils package, so… very likely). If you want to burn a file to multiple media, but you don’t have kdar installed on your desktop… don’t worry about it. Just open a terminal and do:
$ split --bytes=600MB --numeric-suffixes filename.zip filename_part_
In my case, I have a 2.8GB file, but I only have 700MB CDs on hand for my burner. So this command will ensure that I get several 600 “megabyte” (1000 bytes * 1000) pieces, named “filename_part_00,” “filename_part_01,” and “filename_part_02,” et cetera.


Get every new post delivered to your Inbox.