Code

Smatterings of one-liner BASH scripts, sample config files, and other DevOps goodness.

Free command work-alike in OS X

There’s no command that works exactly like the free command in Linux on OS X. You can replicate this with the following code:

#!/bin/sh

top -l 1 | head -n 10 | grep PhysMe

Stick that one-liner in a shell script file and install in /usr/local/bin

 Make WP_HOME and WP_SITEURL dynamic

I often have to set up development and staging WordPress sites. For a while I just did a sed one-liner to just replace the URLs. Why not just make it dynamic where PHP sets the URLs using the SERVER_NAME variable.

define('WP_HOME','http://'. $_SERVER['SERVER_NAME']);
define('WP_SITEURL','http://'. $_SERVER['SERVER_NAME']);

Be First to Comment

Leave a Reply