Detailed look at fonts (show)  

I had no idea fonts display was so detailed, and so complicated. Maxim Shemanarev wrote an extremely detailed analysis of how modern computers display fonts on a screen. I found the second on moving fonts 1/10th of a pixel horizontally fascinating. Interesting read if you like fonts and typography.
Leave A Reply

Perl output buffering on files (show)  

To turn off output buffering in Perl you just do:

Code:

$| = 1;

To do it on an open filehandle you have (so the file gets written right away) do:

Code:

open(LOG,">>$log");
LOG->autoflush(1);
Leave A Reply

Piers Anthony - Xanth (show)  

Here is a borrowed list of Xanth books.
  1. A Spell for Chameleon
  2. The Source of Magic
  3. Castle Roogna
  4. Centaur Aisle
  5. Ogre, Ogre
  6. Night Mare
  7. Dragon on a Pedastal
  8. Crewel Lye
  9. Golem in the Gears
  10. Valey of the Vole
  11. Heaven Cent
  12. Man from Mundania
  13. Isle of View
  14. Quesiton Quest
  15. Color of her Panties
  16. Demons Don't Dream
  17. Harpy Time
  18. Geis of the Gargoyle
  19. Roc and Hard Place
  20. Yon Ill Wind
  21. Faun and Games
  22. Zombie Lover
  23. Xone of Contention
  24. Smell Foop
  25. Up in a Heaval
  26. Cube Route Tor
  27. Currant Events
  28. Pet Peeve
  29. Stork Naked
  30. Air Apparent
  31. Two to the Fifth
  32. Jumper Cable
Leave A Reply

Perlfunc: get_file_perm() (show)  

Quick function to get the permissions of a file with Perl.

Code:

sub get_file_perm {
	my $file = shift();

	# Permissions are the second element of stat
	my $mode = (stat($file))[2];
	my $perm = sprintf("%04o",$mode & 07777);

	return $perm;
}
Leave A Reply

Bash reading a file line by line (show)  

Here are the directions borrowed from the BashFAQ.

Code:

cat /tmp/foo.txt | while read line; do echo $line; done;
Leave A Reply

Linux date manipulation (show)  

The date command in Linux is very powerful for converting dates and times. If you have a given time in another timezone, or even UTC, you can convert it to your local timezone with this command:

Code:

date -d '2008-05-13 14:00 UTC'

If you want to convert a given time into unixtime just use a date format:

Code:

date +%s -d '2008-05-13 14:00 UTC'
Leave A Reply

Free SSL Cert (show)  

I just got a free SSL certificate for this site from StartCom. They have limited browser support, but Firefox is in the list. Not perfect, but not bad for free.
Leave A Reply

Wii/Friend Codes (show)  

Wii code: 2166-1639-8425-8450
Mario Kart Friend code: 2191-8139-1611
Leave A Reply

ImageMagick borders and shadows (show)  

I borrowed this simple ImageMagick hack to make images have a small border and drop shadow.

Original:


Code:

convert foo.jpg -resize 200 -bordercolor white -border 1 -bordercolor black -border 1 -background black bar.jpg


Code:

convert foo.jpg -resize 200 -bordercolor white -border 1 -bordercolor black -border 1 \
-background black \( +clone -shadow 80x1+1+1 \) +swap -background white -flatten bar.jpg


The drop shadow example needs a white background to look decent.
Leave A Reply

Save The Developers (show)  

My good buddy Dave just pointed out a cool site: SaveTheDevelopers.com. They have a cool little javascript script that detects if you're running IE6 (an old browser) and prompts you to upgrade to a newer and more current browser. The code is now live on most perturb.org pages.
Leave A Reply

Lorwyn Dual Lands (show)  



There are only five dual lands (there are 10 color combos), so my guess is they'll do the rest of them in Shadowmoor.
Leave A Reply

Linux encryption - encrypted directories (show)  

I've always been fond of storing a directory structure encrypted in a file (ala TrueCrypt or PGPDisk). I borrowed instructions from here.

Create the raw file to contain your encrypted data.

Code:

dd if=/dev/urandom of=~/encrypted.bin bs=1M count=100

Find the next available loop device and map this file to it.

Code:

losetup -f
losetup /dev/loop0 ~/encrypted.bin

Setup the crypto filesystem, open it with the correct password, format the partition ext3, and finally mount the newly created filesystem as /mnt/tmp

Code:

cryptsetup --verbose --cipher "aes-cbc-essiv:sha256" --key-size 256 --verify-passphrase luksFormat /dev/loop0
cryptsetup luksOpen /dev/loop0 my-crypt
mkfs.ext3 /dev/mapper/my-crypt
mount -t ext3 -o rw,defaults /dev/mapper/my-crypt /mnt/tmp/

When you're all done, and want to secure all the files do the following. Umount the filesystem, close the crypto link, remove the file to loopback device link.

Code:

umount /mnt/tmp/
cryptsetup luksClose my-crypt
losetup -d /dev/loop0
Leave A Reply

10th Edition Dual Lands (show)  

Leave A Reply

RIP Gary Gygax 2008 (show)  

In honor of Gary Gygax dying I wrote a Perl script to roll dice (D&D style). I know a billion people before me have probably written better dice rolling programs, but this was quick, simple, and I was bored.
Leave A Reply

Time keeping nerdiness (show)  

I have not decided if this is totally nerdy, or totally cool (or both).
Leave A Reply