This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$config = (object) array( | |
'db' => (object) array( | |
'host' => '127.0.0.1', | |
'username' => 'root', | |
'password' => '', | |
), | |
// Threshold for how "full" the int columns are, as a percentage. Since we | |
// deal with columns of different sizes, a fixed number isn't appropriate | |
'threshold' => 0.95, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$host = 'localhost'; | |
$username = 'username'; | |
$password = 'password'; | |
$database = 'db'; | |
$prefix = 'wp_'; | |
$newPrefix = 'staging_'; | |
$link = mysql_connect($host, $username, $password); | |
mysql_select_db($database); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'" | |
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'" | |
sudo su - postgres -c "service postgresql stop" | |
sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"' | |
sudo apt-get remove postgresql-9.1 postgresql-client-9.1 -y | |
sudo sed -i "s:5433:5432:g" /etc/postgresql/9.3/main/postgresql.conf | |
sudo service postgresql restart | |
sudo su - postgres -c '~/analyze_new_cluster.sh' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
if ($_SERVER['argc'] < 2) { | |
echo 'Usage: ', basename(__FILE__), ' domain-name.com [domains...]'; | |
die; | |
} | |
foreach ($_SERVER['argv'] as $i => $domain) { | |
// 0 is the script name | |
if (0 === $i) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Force pickup as a shipping option if one or more products in the catalog is marked as pickup only. | |
// To do this, add a shipping class with the slug 'pickup-only' then set products with that class as required. | |
// Add this script to your theme's functions.php or similar. | |
function hideShippingWhenPickupRequired($rates, $package) | |
{ | |
foreach ($package['contents'] as $item) { | |
$product = $item['data']; | |
$shippingClass = $product->get_shipping_class(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Replace new-domain and old-domain as with your values | |
SET @old_domain = '', | |
@new_domain = ''; | |
UPDATE `wp_options` | |
SET `option_value` = REPLACE ( | |
`option_value`, | |
@old_domain, | |
@new_domain | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make the Django server from LiveServerTestCase multi-threaded | |
# so that you can make requests to yourself during tests without | |
# deadlocking. | |
# Note that this prevents being able to use in-memory sqlite for | |
# tests unless you use something like `/dev/shm` | |
# May cause other bugs too | |
from django.core.servers.basehttp import WSGIServer | |
from django.test import testcases | |
from django.utils.six.moves import socketserver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Usage: backup.sh type database username host gdrive-parent-folder-id gpg-recipient | |
# Requires gdrive: https://github.com/prasmussen/gdrive | |
set -e | |
timeslot=$(date '+%Y%m%d%H%M') | |
type=$1 | |
database=$2 | |
user=$3 | |
host=$4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
apt-get update | |
apt-get dist-upgrade -y | |
apt-get autoremove -y | |
apt-get clean | |
apt-get autoclean | |
pip install -U pip virtualenvwrapper | |
npm update -g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
bold=$(tput bold) | |
normal=$(tput sgr0) | |
DIR=`pwd` | |
for project in $(find * -type d -maxdepth 0) | |
do | |
cd $project | |
if [ -d ".git" ] |
OlderNewer