Using Gfortran on OSX Snow Leopard to create 32 and 64 bit executables

This recipe covers setting up installing gfortran on OSX Snow Leopard on a 64 bit machine, like most modern hardware, and using it to generate applications that can run on either 32 or 64 bit Intel.

Precondition: MacPorts should be installed.

1. Check that the universal MacPorts variants are set up for both Intel architectures.
cd /opt/local/etc/macports
cat macports.conf
# Check that the universal_archs line looks like this:
universal_archs x86_64 i386

2. Install gcc45 with Macports using the universal variant.
sudo port install gcc45 +universal
This step takes about 2 hours on a recent MacBook Pro.

3. Create a fortran test program called t.f:
write (*,*) 'hello'
end

4. Build it for 32 bit:
gfortran -m32 t.f
$ file a.out
a.out: Mach-O executable i386

5. And for 64 bit:
gfortran t.f
$ file a.out
a.out: Mach-O 64-bit executable x86_64

ML Raw HTML 1.0.2 Released

I’ve created a simple WordPress plugin which passes through raw html in a wordpress post, which is quite handy for things like javascript ad fragments. It uses shortcodes and is resigned to be more efficient and reliable than the other plugins I looked at which do similar things.

More information is available at the project page – ML Raw HTML.

Configuring msmtp on OSX Snow Leopard to send through gmail

This recipe covers setting up msmtp on OSX Snow Leopard to enable command line tools like mailx to deliver email through Gmail. One advantage of this recipe is that it does not touch any Apple-provided system configuration files, so it is independent from OS updates.

Precondition: MacPorts should be installed.

1. Install msmtp with Macports.
sudo port install msmtp

2. Install the certificate bundle.
sudo port install curl-ca-bundle

3. Edit ~/.msmtprc to contain:
account default
host smtp.gmail.com
port 587
timeout 30
auth on
user YOUR@EMAIL.HERE
password YOURPASSWORD
auto_from off
from YOUR@EMAIL.HERE
tls on
tls_starttls on
tls_trust_file /opt/local/share/curl/curl-ca-bundle.crt

4. Set permissions on .msmtprc:
chmod 600 ~/.msmtprc

5. Test the configuration. The test file should start with a blank line.
msmtp -d TEST@EXAMPLE.COM < hello.txt

6. Edit ~/.mailrc to contain:
set sendmail=/opt/local/bin/msmtp

This recipe is based in part on a useful article at magictalong.

Javascript Nofollow Links 1.0 Released

I’ve created a simple WordPress plugin which changes comment authors’ links from nofollowed anchor tags to javascript based links. This is in reaction to the recently announced change in the way Google handles the nofollow tag.

More information is available at the project page – Javascript Nofollow Links.