Archives

All posts for the day June 21st, 2007

Sometimes I have to use Windows. However, life isn’t always TOO bad. There is a vim port for windows. However, it does have some default settings that really drive me crazy.

If you have ever installed it, you know what I mean. When you open any file, it creates a temporary swap file. This is fine in Linux, because I always have multiple terminals doing multiple things at once. However, we don’t have that in Windows. Don’t pretend you do. The other setting is the automatic backup option. Open a file, edit, then save. It will create a backup of the original file. To me, that’s not needed.

To fix this, go to your _vimrc file. The default location is in C:\Program Files\Vim. Add these lines to the bottom of the file, and you are all set:

set nobackup
set nowritebackup
set noswapfile

Save and exit. Simple when you know how.

I am EXTREMELY paranoid. Read that again: EXTREMELY paranoid. I tend to back up important data two or three times to multiple locations. It’s just not worth the headache of losing it. So kids, here is a quick and dirty bash script to dump all of your MySQL databases and compress them into individual archives. I know it’s not rocket science, but can it, it works.

#!/bin/bash
password="mysqlrootpassword"
backupdir="/home/backup/mysqldumps/"
cd $backupdir
for database in $(mysql --password=$password -e "show databases" | grep "^\|" | grep -v Database);
do
  mysqldump --password=$password $database | bzip2 > $database.sql.bz2;
done
chmod 600 $backupdir/*

Please excuse the ugly spacing, the wordpress theme seems to have chopped it up a bit.