Micha Niskin

May 30, 07:49 AM
Category  

Here is a shellscript I wrote to handle my master password file. It uses PGP for encryption.

Features:

  • You can use it just like you would use vipw(8) or visudo(8).
  • The data is never on the disk in an unencrypted state. There are no temporary files or anything like that containing plaintext.
  • Can (optionally) make full use of RCS(1) for version control.

You can download the script here.

Comment

Micha Niskin

Sep 17, 02:03 PM
Category  

This link is a pretty good reference for setting tabs and indentation in vim. I find the :retab command especially useful when I’m editing a file that has mixed tabs and spaces in it and I want to clean it up and have only spaces for indentation.

In this case doing a find/replace substitution for the tabs (like :%s/^I/ /g, for example) doesn’t really do what you want it to do. I mean, the whole point of having tabs is that they are not all the same width—-some of them may occupy only one character of space, while another may occupy 4 characters of space, depending on how you have your tabstops set. But :retab does it beautifully.

From the page:

After the ‘expandtab’ option is set, all the new tab characters entered will be changed to spaces. This will not affect the existing tab characters. To change all the existing tab characters to match the current tab settings, use :retab.

When you use this it’s probably a good idea to put a modeline at the top or bottom of the file to prevent those tabs from getting back in there.

Comment

Micha Niskin

Jul 6, 08:03 AM
Category  

Everyone has their own preferred way of setting up their vi environment. Some people like to set the width of a tab to two characters, and some people prefer to set it to eight characters. Some people like to have vi pad out the tabs with spaces instead of writing actual tab characters. Stuff like that. (If you are one of those sorry bastards who has to work with python you’ll know what I mean.)

Vim lets you embed options in the file itself so that other people who edit the file in vim will see it the way you do—all the tabs will line up correctly, etc., regardless of how they have their ~/.vimrc file set up. This is called a modeline, in the parlance of our times.

I like to set the tabs to two characters when I’m writing code. So suppose I’m editing a shell script or something.

#!/bin/sh
# vim:ts=2:sw=2:expandtab:cindent

if /usr/local/bin/optimo; then echo optimo engaged fi

Vim scans the first and last few lines of the file for modelines, if the modeline option is on (which it is, by default). If it finds any it will apply those settings as if you had typed them in manually using :set in command mode.

In the example above I set the tabstop and shiftwidth to two characters and set the expandtab and cindent options.

For the complete description check the vim help file (in vim type :help auto-setting and :help modeline).

Comment

Micha Niskin

Jun 19, 02:01 PM
Category  

Oh, man. This right here is incredible. LDAP is a PITA when you have to do stuff from the command line. Lots of typing involved, LDIF files, and so forth. This is my new favorite thing: ldapvi .

ldapvi is an interactive LDAP client for Unix terminals. Using it, you can update LDAP entries with a text editor. Think of it as vipw(1) for LDAP.

This is unbelievably awesome.

Comment

Micha Niskin

May 23, 08:17 AM
Category  

There’s a great little application to do this called antiword . It’s open source and available for lots of operating systems. There is even a version for Windows which is awesomely zen.

From the author’s site:

Antiword is a free MS Word reader for Linux and RISC OS. There are ports to FreeBSD, BeOS, OS/2, Mac OS X, Amiga, VMS, NetWare, Plan9, EPOC, Zaurus PDA, MorphOS, Tru64/OSF and DOS. Antiword converts the binary files from Word 2, 6, 7, 97, 2000, 2002 and 2003 to plain text and to PostScript.

There is also a “programmer’s version” which is available as source. It has more features and can convert Word documents to plain text, PostScript, PDF and XML/DocBook.

Comment [1]

Previous