CMake and C++ “Compile Time” Polymorphism

For a recent project of mine, I wanted to use what some people call “Compile Time Polymorphism” in C++. Here’s how I implemented it. Polymorphism in the context of programming computers usually refers to the ability to tread objects of a different data type through the same interface. In C++, this is often implemented through […]

ImageMagick, libjpeg, etc. on Mac OS X

Here’s how I got ImageMagick with JPEG support to compile and run on Mac OS X 10.6 (Intel). First, I got the ImageMagick Source Code via Subversion, per the instructions from http://www.imagemagick.org/script/subversion.php. Short version: $ svn co https://www.imagemagick.org/subversion/ImageMagick/branches/ImageMagick-6.6.5 ImageMagick-6.6.5 Then, I pulled libjpeg from the Independent JPEG Group. I had to extract the source code […]

Generating random passwords

Here are a couple of ways of generating random passwords without using a “password generator”. First, generate a random string like this: $ dd if=/dev/urandom count=500 bs=1 | tr “n” ” ” | sed ‘s/[^a-zA-Z0-9]//g’ or like this $ dd if=/dev/urandom count=500 bs=1 | md5 Then adjust the length by piping the output through cut(1): […]