Skip to content

Instantly share code, notes, and snippets.

View petertoi's full-sized avatar

Peter Toi petertoi

View GitHub Profile
@petertoi
petertoi / .gitignore
Last active August 29, 2015 14:04 — forked from redoPop/.gitignore
.gitignore template for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@petertoi
petertoi / README.md
Created August 5, 2014 15:33
Installation instructions for checking out GIT project into existing WordPress directory

Installation Instructions

  1. Git clone project to a temp folder
  2. Install Wordpress to the project folder
  3. Copy .git/ from temp folder to project folder
  4. Remove temp folder
  5. Run: git checkout -- .
  6. Load the site in your browser and run the install to generate wp-config.php
@petertoi
petertoi / sshkey2remote.sh
Last active August 29, 2015 14:14
Upload local id_rsa.pub to remote .ssh/authorized_keys
#!/bin/sh
#
# Author: Peter Toi
# Source: https://gist.github.com/petertoi/24b598eb269fac767cc7
#
# Usage 1: $ sshkey2remote.sh # No argument will result in prompts
# Usage 2: $ sshkey2remote.sh user@host # Skip the prompts by including the argument
if [ "$#" -eq 1 ]
then
@petertoi
petertoi / sphp.sh
Created February 6, 2015 15:41
Switch homebrew PHP versions
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: sphp [phpversion]"
exit 1
fi
currentversion="`php -r \"echo str_replace('.', '', substr(phpversion(), 0, 3));\"`"
newversion="$1"
@petertoi
petertoi / wgetseq.sh
Created February 23, 2015 14:46
Download sequentially named files from command line
#!/bin/bash
#
# Author: Peter Toi
# Source: https://gist.github.com/petertoi/b61ac28f2cd27a2c645d
#
# Usage 1: $ wgetseq.sh # No argument will result in prompts
# Usage 2: $ wgetseq.sh starturl endurl startnum endnum # Skip the prompts by including the arguments
if [ "$#" -eq 4 ]
then
@petertoi
petertoi / check_plugin_version.sh
Created March 13, 2015 15:43
Performs a recursive scan from the current directory for the specified file and outputs matched files and plugin version
#!/bin/sh
#
# Author: Peter Toi
# Source: https://gist.github.com/petertoi/79d77b041f1f8f93c456
#
# Usage 1: $ check_plugin_version.sh # No argument will prompt for plugin file name
# Usage 2: $ check_plugin_version.sh pluginfile # Skip the prompts by including the file name as an argument
if [ "$#" -eq 1 ]
then
@petertoi
petertoi / injectionscan.sh
Last active August 29, 2015 14:17
Script for searching all .php files for evidence of PHP injections
#!/bin/sh
#
# Author: Peter Toi
# Source: https://gist.github.com/petertoi/23d072d1d8589d9f5386
#
# Usage 1: $ injectionscan.sh
rm -fr injections.txt
touch injections.txt
@petertoi
petertoi / dh_installnode.sh
Last active April 18, 2020 00:53
Install Node.js on Dreamhost shared hosting
#!/bin/sh
NODEVERSION=v0.12.2
SRCPATH=$HOME/src/node
LOCALPATH=$HOME/usr/local
BINPATH=$LOCALPATH/bin
mkdir -p $SRCPATH
mkdir -p $LOCALPATH
@petertoi
petertoi / digall.sh
Created April 15, 2015 21:06
List all DNS records in a domain using dig
#!/bin/sh
#
# Author: Peter Toi
# Source: https://gist.github.com/petertoi/8f7e42b867cbb85ec47b
#
# Usage 1: $ digall.sh # No argument will prompt for domain
# Usage 2: $ digall.sh domain # Skip the prompts by including the domain as an argument
if [ "$#" -eq 1 ]
then
@petertoi
petertoi / vvv-redirect-wpmu-files.conf
Last active August 29, 2015 14:21
nginx snippet for redirecting local VVV WPMU dev site /files to another domain
# Be sure to comment out the /files rules in /vagrant/config/nginx-config/nginx-wp-common.conf
# then add this to the bottom of the your /vagrant/config/nginx-config/sites/domain.conf
# replace 'domain' with the domain associated with your project
if ($http_host ~ (.*)\.domain\.dev) {
set $subdomain $1;
}
location ~ ^/files/(.*) {
rewrite ^/files/(.*)$ http://$subdomain.domain.com/files/$1 redirect;
}