Posted on , modified on

CloudFlare is a great service and I’ve been using for my horrell.ca site for some time. It speeds everything up, acts as a firewall protecting your site from bots and jerks, and also provides IPv6 support. One side affect of using CloudFlare is the Apache logs for your site will show IP addresses from the CloudFlare network for any site visitors rather than the true visitors IP address. You can fix that by installing the mod_cloudflare Apache module.

Here’s how to install it on a new Joyent SmartMachine


  1. First, download the mod_cloudflare.c source file from CloudFlare’s Github repos (the -L flag makes sure curl follows any redirects):
    curl -OL https://raw.github.com/cloudflare/CloudFlare-Tools/master/mod_cloudflare.c
    
  2. Install the gcc compiler:
    pkgin install gcc47
  3. Now compile and install the module:
    apxs -c -i mod_cloudflare.c

    If you have a 64 bit machine, you’ll need to use something like this instead:


    apxs -Wc,-m64 -Wl,-m64 -c -i mod_cloudflare.c

  4. Set the permissions:
    chmod 755 /opt/local/lib/httpd/mod_cloudflare.so

  5. Add this to your /opt/local/etc/httpd/includes/dso.conf (this will load the module when Apache starts):
    LoadModule cloudflare_module lib/httpd/mod_cloudflare.so
  6. Now refresh Apache to load the module:
    svcadm refresh apache

And that’s it! If you check your Apache logs (/var/log/httpd/access.log or /home/NAMEOFSITE/logs/access.log) you should start seeing accurate IP addresses.

You can check if the installation went smoothly with:

svcs -vx apache

If Apache is in maintenance, chances are something went wrong with loading the module. The /var/svc/log/network-apache:default.log service log file will give an idea of what you need to fix.

Periodically, CloudFlare adds new IP addresses to their network, so you’ll need to reinstall the module. You don’t need to do anything special for that, just repeat the above steps using the updated mod_cloudflare.c. source file. I follow the git repos for changes (which doesn’t happen that often).

Posted on , modified on

The introduction of folders to iOS was a welcome addition to keeping your home screen tidy. Folders allows you to sensible group like applications and then give the folder a given name, like “Games” for all your game apps etc. In iOS 5, Emoji support was added which means you can also use Emoji as icons in your folder names for added bit of flare, like this:

iPhone home screen example

Cool huh?

So here’s what you need to do to enable Emoji and then use it in a folder name.

First, enable Emoji support by going to SettingsGeneralKeyboardInternational KeyboardsAdd New KeyboardEmoji

All done? Good! Now, touch and hold a folder you want to add an Emoji icon to and then touch it again and you’ll see something like this:

Editing folder in iOS

Cool, now touch the folder name (in this example Games) and you’ll see something like this:

Editing a folder name in iOS

You may have noticed the new globe icon on the keyboard Globe. Touch it and you’ll see something like this:

Emoji!

Tada, an Emoji keyboard!

From here, pick the Emoji you’d like to use, insert it into the folder name (I like to put them at the beginning), touch the globe icon again and then touch Done. The keyboard will then disappear and you can press the Home button to save you changes.

You may have noticed that I had an  icon for the folder in the top right, but that icon is not actually available via the Emoji keyboard. I used Neven Mrgan’s cool Glyphboard to add it. From Glyphboard, I just copied the  icon and then pasted it in the folder name.

Posted on , modified on

Here are some updated instructions for installing the latest stable version of node (v0.4.12), as well as npm, on a Joyent SmartMachine.

These instructions install node in the ~/local directory avoiding the need for root privileges when installing things with npm, which is bad.

First, create a ~src/ directory — this is where we’ll download the latest version of node.

mkdir ~/src
cd ~/src
curl -O http://nodejs.org/dist/node-v0.4.12.tar.gz

Now untar it:

gtar -xpf node-v0.4.12.tar.

Create the ~/local directory if it doesn’t already exist:

mkdir ~/local

Now lets add it to your PATH:

echo 'export PATH=$HOME/local/bin:${PATH}' >> ~/.bashrc 
. ~/.bashrc

Now, configure, build, and install node:

cd node-v*
./configure --with-dtrace --prefix=~/local
gmake install

The gmake part will probably take the longest. And you’ve probably noticed I’m using gtar instead of tar and gmake instead of make. There are some difference between the Solaris versions and the GNU versions.

Ok, now let’s get things setup for npm:

echo tar = gtar >> ~/.npmrc
echo root = $HOME"/.node_libraries" >> ~/.npmrc
echo binroot = $HOME"/local/bin" >> ~/.npmrc
echo manroot = $HOME"/local/share/man" >> ~/.npmrc

Ok, now lets install npm:

curl http://npmjs.org/install.sh | sh

And that’s it!

Posted on , modified on

I hate the caps lock key. Hate. I’m always, always pressing it by accident. I don’t do it that often on my iMac, but boy howdy, I click it all the time on my MacBook Pro. At my old gig, when I did the nine to five thing in a beige cubicle (it might have been a dirty white, actually) I removed it from the keyboard and put it in a drawer (see blurry photo here. Now that’s just not something I want to do with my Mac hardware. The IBM keyboard at work was easy enough, but I don’t even know if it’s possible on the newer Mac keyboards. Plus it looks bad and isn’;t the most elegant solution so I’ve had to put up with it. Until now!

If you own a Mac and have the same stewing hate for the caps lock key that I do, here’s how you can disable it.

  1. Open System Preferences
  2. Select Keyboard
  3. Click the Modifier Keys… button. You should now see something like this:
    Keyboard Preferences
  4. Change the Caps Lock key value to No Action so that it looks like this:
    Caps lock disabled!
  5. Click OK.

And thats it, no more caps lock key madness!

← Older Newer →