Automatic disposable email addresses for Google Apps

Plus Suffixing

There’s a pretty nifty feature with gmail that most people don’t know about. I’ve seen people reference it as the “plus hack” or “plus suffixing”. If you have username@gmail.com, you can add a “+” followed by any letters and numbers, and it will still be delivered to username@gmail.com.

I’ve been using this for corporate email forms — if facebook wants an email, they get matthew+facebook, for example. I can then add a precise filter on that “To:” address and delete all email from that company if it “goes evil.”

There’s a glitch in plus suffixing, though — most web forms don’t realize that the plus sign is a totally valid email character, and will reject your plus-suffixed hack.

So what to do?

Well, if you’re using gmail, you’re out of luck. But if you’re using a google apps account for a custom domain (say, your company or family), and you are an administrator for that domain, you can enable “minus suffixing”!

Continue reading

Apache2, PHP, and MySQL on Mac OS X using MacPorts

1. Install MacPorts

Follow the instructions here: http://www.macports.org/install.php.

2. Install apache2

sudo port install apache2

Note that the macports instructions suggest installing the launchctl script now, but we’ll do that after mysql and php are installed.

3. Install and configure MySQL

If you want 5.0.x, use mysql5-server. If you need 5.1.x, install mysql5-server-devel (at least as of August 2009).

sudo port install mysql5-server

As the macports instructions state,

In order to setup the database, you might want to run sudo -u mysql mysql_install_db5 if this is a new install.

It’s never a bad idea to set the root password, and as the document suggests, run:

/opt/local/lib/mysql5/bin/mysqladmin -u root password 'new-password'

You also want to install a database configuration file — there are a bunch of templates in /opt/local/share/mysql5/mysql/, but for development, my-small.cnf should suffice:

sudo cp /opt/local/share/mysql5/mysql/my-small.cnf /opt/local/etc/mysql5/my.cnf

Once the config is in place, spin up mysql:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist

Check that mysql is up and running by connecting with the mysql client:

mysql -h localhost -u root -p

4. Fix your PATH

Note that the mysql binaries in /opt/local/bin all have a “5″ suffix, but /opt/local/lib/mysql5/bin has “normal” named binaries, so you probably want that in your PATH too. The apachectl in /usr/bin will spin up the mac os x version of apache (that we’re avoiding), and that lives in /opt/local/apache2/bin. So in your .bashrc (or .profile or whatever):

export PATH=/opt/local/bin:/opt/local/sbin:/opt/local/lib/mysql5/bin:/opt/local/apache2/bin:$PATH

5. Install PHP5

sudo port install php5 +pear +apache2 +fastcgi +mysql5

Note that php5 has a lot of variants. If you think you want other goodness, run port variants php5 and cook up your own set of options.

Again, as the macports instructions state,

copy /opt/local/etc/php5/php.ini-development (if this is a development server) or /opt/local/etc/php5/php.ini-production (if this is a production server) to /opt/local/etc/php5/php.ini and then make changes.

6. Install the PHP-MySQL driver:

sudo port install php5-mysql +mysql5

7. Configure apache2

The mod_php.conf from the php5 package is put into a directory that the apache2 configuration doesn’t read by default — so you need to add this line to the end of /opt/local/apache2/conf/httpd.conf:

Include conf/extras-conf/*

Hopefully this will be considered a packaging bug, and will be fixed at some point.

8. Run apache2

sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

Note that the logs, by default, are in /opt/local/apache2/logs.

If you change the PHP or Apache configuration files, run

sudo /opt/local/apache2/bin/apachectl restart

and watch the logs for errors.

How to pause crashplan on Mac OS X

Crashplan on Windows has a taskbar icon that lets you put the backup daemon to sleep, but the Mac OS X port doesn’t seem to have this functionality.

You can’t just kill the backup daemon process. The OS X “launchd” superviser daemon will see the process go away, and immediately respawn the process. You have to tell launchd to stop the backup daemon by using the launchctl command:

sudo launchctl unload /Library/LaunchDaemons/com.crashplan.engine.plist

The crashplan daemon will start again after you reboot, or you manually restart it:

sudo launchctl load /Library/LaunchDaemons/com.crashplan.engine.plist