Skip to content

Instantly share code, notes, and snippets.

View insanedefaults's full-sized avatar
Sailin' on by

Michael Anthony insanedefaults

Sailin' on by
View GitHub Profile
@insanedefaults
insanedefaults / interconnectit.sh
Created February 13, 2015 01:11
Command line tool for use with Interconnectit's Search and Replace for WordPress
interconnectit() {
if [[ -z $1 ]] || [[ $1 == "help" ]]; then
echo "usage: interconnectit search_for replace_with your_email"
echo "Email is optional- if you provide it, an email will be sent to you once the search and replace finishes."
echo "Run this from the root of the WordPress you want the search and replace done on."
else
#acquire and prep search and replace script
wget https://github.com/interconnectit/Search-Replace-DB/archive/master.zip
unzip master.zip && rm master.zip
@insanedefaults
insanedefaults / checkup.sh
Last active July 8, 2017 03:12
Perform basic checks on a WordPress install with wp-cli
checkup() {
install=$(pwd | cut -d / -f 6)
environment=$(pwd | cut -d / -f 5)
echo "Install: ${install}" | egrep --color ".*"
#home and siteurl
wp db query "SELECT option_name, option_value FROM $(wp db tables | grep options) WHERE option_name='home' OR option_name='siteurl'"
echo
echo "Theme Information:" | egrep --color ".*"
wp theme status
@insanedefaults
insanedefaults / asha.py
Last active August 29, 2015 14:17
Python Example
# for asha
# This is a list of dictionaries, saved into people
people = [
{
'name' : 'tim',
'eyes' : 'brown',
'silly' : False
},
{
@insanedefaults
insanedefaults / geoip.py
Last active August 29, 2015 14:19
Python CLI tool for geoip lookup
from multiprocessing import Pool
import argparse
import requests
import sys
#Functions
def getgeo(ip):
"""Give this a string of an IPv4 or IPv6 address
Returns a dict with geographical data about the ip
"""

Tell us a little bit about yourself:

Birthday:

June 15th

Age:

About to enter my 3rd decade of life

<?php
/**
* This file can be used to validate that the WordPress wp_mail() function is working.
* To use, change the email address in $to below, save, and upload to your WP root.
* Then browse to the file in your browser.
*
* For full discussion and instructions, see the associated post here:
* http://b.utler.co/9L
*
* Author: Chad Butler
@insanedefaults
insanedefaults / example.md
Last active August 29, 2015 14:23
Turns off a given plugin for each subsite on a WordPress multisite. This is useful if the plugin isn't activated network-wide.
$ turnoffplugin query-monitor
site.com/ :: Success: Plugin 'query-monitor' deactivated.
test.site.com/ :: not deactivating, plugin status is inactive
test2.site.com/ :: not deactivating, plugin status is inactive
$ turnoffplugin query-monitor
site.com/ :: not deactivating, plugin status is inactive
@insanedefaults
insanedefaults / inode_counter.sh
Created July 15, 2015 01:54
Count inodes in style
function inode_counter() {
#give me a path
#i'll count the inodes recursively
#I'm pretty slow, but I'm real purdy
path=$1
z=0
find $path 2>/dev/null | while read x
do ((z++))
printf '\r%-16s %-8s' "$install" "$z"
done

Disable Plugins

Quickly disable all plugins in WordPress.

Usage

This plugin needs to go into the wp-content/mu-plugins/ directory. Provided you have SSH access to the server where WordPress lives, you can do this:

cd $SITE_ROOT/wp-content/mu-plugins