Skip to content

Instantly share code, notes, and snippets.

Travis Smith wpsmith

Block or report user

Report or block wpsmith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wpsmith
wpsmith / install-wp.sh
Last active Nov 12, 2019
Bash Shell: Sets up an AWS Linux 2 Server for WordPress using NGINX.
View install-wp.sh
#!/bin/bash
##############################################################
# Set Your System and Wordpress Config Preferences
##############################################################
export SYSTEM_USER=nginx # User PHP-FPM runs under
export SYSTEM_GROUP=www # User PHP-FPM runs under
# Database
View bucket_policy.json
{
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket_name_here/*"
View New-SPApplicationPool.ps1
asnp *SharePoint* -ErrorAction SilentlyContinue
// URL of the Web App to change the Application Pool of.
$WebAppURL = "http://WebApp"
// name of the name Application Pool that will be created.
$NewAppPoolName = "NewAppPool"
//the user account that the Application Pool will run under the context of.
$NewAppPoolUserName = "contoso\apppool"
View installgo-aws.sh
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
sudo yum update -y
sudo yum install git curl make bison gcc glibc-devel -y
# Install GVM
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source /home/ec2-user/.gvm/scripts/gvm
# Add to ~/.bash_profile
echo 'source /home/ec2-user/.gvm/scripts/gvm' >>~/.bash_profile
View gist:371367e512d2dac8671d6391320cb178
JnS printStringName
Halt
Print, HEX 2 /Address of string
PrintString, LoadI myName /Start of subroutine
Skipcond 800 /If AC is greater than 0 then skip next instruction
JumpI Print /Jump to the address stored in Print
Output
Clear
@wpsmith
wpsmith / mu-admin-user.php
Created Sep 8, 2019
PHP: Create/Add admin user
View mu-admin-user.php
<?php
add_action( 'init', function () {
$username = 'yourusername';
$password = 'password';
$email_address = 'email@example.com';
if ( ! username_exists( $username ) ) {
$user_id = wp_create_user( $username, $password, $email_address );
$user = new WP_User( $user_id );
View wps_load_scripts.php
<?php
add_action( 'wp_enqueue_scripts', 'wps_load_scripts' );
/**
* Enqueue Isotope
* For commercially developed child themes, you must obtain a license
* from isotope.metafizzy.co for approx. $25.
*
* @author Travis Smith
* @link http://wpsmith.net
@wpsmith
wpsmith / WPS_Extend_Plugin.php
Last active Aug 27, 2019
PHP: WPS_Extend_Plugin Class designed to declare a plugin dependency and used for extending a plugin.
View WPS_Extend_Plugin.php
<?php
/**
* Contains WPS_Extend_Plugin class. and wps_extend_plugins function.
*
* @package WPS_Core
* @author Travis Smith <t@wpsmith.net>
* @copyright 2015 WP Smith, Travis Smith
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @version 1.0.0
* @since File available since Release 1.0.0
@wpsmith
wpsmith / browser-language-codes.js
Created Nov 22, 2013
JS: Object of Browser Language Codes
View browser-language-codes.js
// <![CDATA[
var langCodes = {
"af": "Afrikaans",
"sq": "Albanian",
"ar": "Arabic (Standard)",
"ar-dz": "Arabic (Algeria)",
"ar-bh": "Arabic (Bahrain)",
"ar-eg": "Arabic (Egypt)",
"ar-iq": "Arabic (Iraq)",
"ar-jo": "Arabic (Jordan)",
@wpsmith
wpsmith / New-ErrorRecord.ps1
Created Apr 16, 2015
PowerShell: Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
View New-ErrorRecord.ps1
<#
.Synopsis
Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
.Description
Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
.Parameter Exception
The Exception that will be associated with the ErrorRecord.
You can’t perform that action at this time.