Skip to content

Instantly share code, notes, and snippets.

View robinnorth's full-sized avatar
:octocat:

Robin North robinnorth

:octocat:
View GitHub Profile
@robinnorth
robinnorth / node_chown-global-modules.sh
Created May 15, 2014 08:01
Changes ownership of global `node_modules` directory to current user on OS X
sudo chown -R `whoami` /usr/local/lib/node_modules
<?php
/**
* Create ACF setting page under Events CPT menu
*
* @since 1.0.0
*/
if ( function_exists( 'acf_add_options_sub_page' ) ){
acf_add_options_sub_page(array(
'title' => 'Event Settings',
'parent' => 'edit.php?post_type=events',
@robinnorth
robinnorth / git_bulk-delete-remote-tags.sh
Last active December 16, 2015 05:28 — forked from technogoat/gist:1528381
Git: Bulk delete remote tags
$ git ls-remote --tags origin | awk '/^(.*)(\s+)(.*[a-z])$/ {print ":" $2}' | xargs git push origin
@robinnorth
robinnorth / git_bulk-delete-local-tags.sh
Created April 14, 2013 21:49
Git: Bulk delete local tags
$ git tag | awk '/^(.*\w)$/ {print $1}' | xargs git tag -d
@robinnorth
robinnorth / wordpress_prepare-database-for-production.sql
Created April 15, 2013 08:22
WordPress: Prepare database for production environment
# Update options
UPDATE wp_options SET option_value = REPLACE( option_value, 'staging.com', 'production.com' );
# UPDATE wp_options SET option_value = REPLACE( option_value, 'admin@staging.com', 'admin@production.com' );
# Update inline images
UPDATE wp_posts SET post_content = REPLACE( post_content, 'staging.com', 'production.com' );
# Update image attachment GUID
UPDATE wp_posts SET guid = REPLACE( guid, 'staging.com', 'production.com' ) WHERE post_type = 'attachment';
@robinnorth
robinnorth / wordpress_delete-post-revisions.sql
Created April 15, 2013 08:23
WordPress: Delete post revisions
DELETE a, b, c
FROM wp_posts a
LEFT JOIN wp_term_relationships b
ON a.ID = b.object_id
LEFT JOIN wp_postmeta c
ON a.ID = c.post_id
WHERE a.post_type = 'revision';
@robinnorth
robinnorth / bash_wget-mirror-website.sh
Created May 17, 2013 15:32
Bash: Create a static mirror of a website using wget
$ wget --mirror --no-parent --adjust-extension --restrict-file-names=windows --convert-links --page-requisites --verbose --directory-prefix=/home/user/path http://www.example.com/
#!/bin/bash
# Uninstall node.js
#
# Options:
#
# -d Actually delete files, otherwise the script just _prints_ a command to delete.
# -p Installation prefix. Default /usr/local
# -f BOM file. Default /var/db/receipts/org.nodejs.pkg.bom
@robinnorth
robinnorth / ip-up
Created December 14, 2016 16:35 — forked from p120ph37/ip-up
PPP VPN split-network/split-DNS script for OSX
#!/bin/sh
####################################################
## ##
## PPP VPN split-network/split-DNS script for OSX ##
## by Aaron Meriwether ##
## ##
## installation: ##
## sudo cp thisfile /etc/ppp/ip-up ##
## sudo chmod 755 /etc/ppp/ip-up ##
## ##
@robinnorth
robinnorth / server-to-server-scp.sh
Last active November 24, 2017 10:43
Server to server SCP files
scp -rv <user>@<remote_host>:<remote_source_path>* <local_target_path>