Skip to content

Instantly share code, notes, and snippets.

@phillcoxon
phillcoxon / backup.sh
Created November 1, 2016 11:20 — forked from bradt/backup.sh
Simple WordPress Backups v2
#!/bin/bash
NOW=$(date +%Y%m%d%H%M%S)
SQL_FILE=${NOW}_database.sql
# Backup database
wp db export ../backups/$SQL_FILE --add-drop-table
# Compress the database file
gzip ../backups/$SQL_FILE
@phillcoxon
phillcoxon / Contract Killer 3.md
Created June 19, 2016 00:00
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@phillcoxon
phillcoxon / gist:799327a9b392555c9cc8
Created October 16, 2015 04:05
WordPress debug script (put in wp-config.php)
define( 'WP_DEBUG', true );
if ( WP_DEBUG ) {
define ('JETPACK_DEV_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'SCRIPT_DEBUG', true );
if ( defined( 'DOING_AJAX' ) && DOING_AJAX || defined( 'DOING_CRON' ) && DOING_CRON ) {
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
} else {
@phillcoxon
phillcoxon / gist:bd8ac321348bea0322d6
Created October 16, 2015 04:05
WordPress debug script (put in wp-config.php)
define( 'WP_DEBUG', true );
if ( WP_DEBUG ) {
define ('JETPACK_DEV_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'SCRIPT_DEBUG', true );
if ( defined( 'DOING_AJAX' ) && DOING_AJAX || defined( 'DOING_CRON' ) && DOING_CRON ) {
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
} else {
@phillcoxon
phillcoxon / gist:09760a88e08928cf84d8
Created September 30, 2015 02:05
MailMate Custom Keybindings
{
// Jeremy's person key bindings for MailMate
//http://jeremy.cowgar.com/2014/09/22/my-mailmate-keybindings/
// Email Creation
"c" = "newMessage:";
"r" = "replyAll:";
"R" = "replySender:";
"f" = "forwardMessage:";

How-To: Install Memcache on CentOS (WHM/cPanel)

Without wasting much time, Let us get started!

Follow these simple instructions:

  • Step 1: Login into your WHM panel and using easyapache enable Memcache

  • Step 2: SSH into your server and fire this command yum install memcached.x86_64 php-pecl-memcache.x86_64

To set up MySQL backups we need to:
1) open up port 3360 in Config Services Firewall but only for the specified remote IP Address
See: http://crybit.com/enable-remote-mysql-csf/
Step I : Enable the port 3306 only for the specific IP address:
This can be done in the CSF configuration file ‘/etc/csf/csf.allow‘
# vi /etc/csf/csf.allow
@phillcoxon
phillcoxon / locate_old_wp_versions.sh
Last active August 29, 2015 14:01
Find old WordPress installs
#!/bin/bash
# Finds WP installs and displays version numbers in current directory, or directory specified by -d <path>
# Very rough - needs tidy up and improvement
# Would be cool if it could look up latest version and compare any installs found to show only old installs
function usage
{
echo "usage: locate_old_wp_versions.sh [-d | --dir] [-h | --help]"
}
<?php
// Warning: this will overwrite every post in your database
// BACKUP FIRST!
clean_post_content();
function clean_post_content() {
$posts = get_posts(array(
'post_type' => array('post'), // or page, or cpt
'post_status' => 'publish', // or any, draft, etc