Skip to content

Instantly share code, notes, and snippets.

View dtateii's full-sized avatar

Dave Tate dtateii

View GitHub Profile
@dtateii
dtateii / Package up an FTP Deployment
Last active April 21, 2016 20:45
Recursively copy changed files between two Git tags (or commits) to another location.
git diff --name-only v0.3 v0.4 | xargs -I{} rsync -Rv "{}" ~/Desktop/destination-dir/
@dtateii
dtateii / bash_profile.sh
Last active January 1, 2016 01:43
Bash Profile [Nate Landau]
# ht: http://natelandau.com/my-mac-osx-bash_profile/
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
@dtateii
dtateii / rscloudsite_archive.sh
Last active August 29, 2015 14:01
Script cron can run to archive db and files on a Rackspace Cloud Site
#!/bin/sh
# http://www.rackspace.com/knowledge_center/article/how-to-use-cron-to-backup-cloudsites-to-cloudfiles
# Set information specific to your site.
domainroot="www.domain.com"
db_host="mysqlnn-nnn.abcd.stabletransit.com"
db_user="nnnnnn_abcd_dbu"
db_password="**********"
db_name="nnnnnn_abcdefg"
#!/bin/sh
# http://www.rackspace.com/knowledge_center/article/how-to-use-cron-to-backup-cloudsites-to-cloudfiles
# Extract archive
#Set information specific to your site
webroot="www.domain.com"
backupname="2015-01-31_13:34/web.tar.gz"
#Backup Site
@dtateii
dtateii / dploy-post.sh
Last active August 29, 2015 14:05
Simple Webhook for use on Rackspace Cloud Sites with Dploy, when deployment includes code outside webroot, and webroot directory to be deployed has name other than 'content'.
#!/bin/sh
# Post deployment routine
#
# Syncs files from webroot deployed with source-controlled
# dir name to Rackspace Cloud Sites webroot dir, 'content'
mount="/mnt/stor{***}/{******}/{******}"
domain="sub.domain.com"
webroot_source="web" # Webroot according to source-control
webroot_apache="content" # Webroot Apache will be serving
@dtateii
dtateii / static_html
Created October 10, 2014 19:44
Apache Rewrites for static html site
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# Remove index.html if entered
RewriteCond %{REQUEST_URI} ^/index.html$
RewriteRule (.*) / [R=301,L]
# Remove display of .html for any html file request
RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /.+\.html\ HTTP
RewriteRule ^(.+)\.html$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
@dtateii
dtateii / widget-context-negation.patch
Created December 18, 2014 22:45
Wordpress Widget_Context URL negation patch
diff --git a/wp-content/plugins/widget-context/widget-context.php b/wp-content/plugins/widget-context/widget-context.php
index 477574a..dd88576 100755
--- a/wp-content/plugins/widget-context/widget-context.php
+++ b/wp-content/plugins/widget-context/widget-context.php
@@ -415,15 +415,47 @@ class widget_context {
function context_check_url( $check, $settings ) {
+ global $wp;
+ $current_path = trim( $wp->request );
@dtateii
dtateii / large_dirs.sh
Created March 16, 2015 17:51
List largest directories
du -k /Documents/ | sort -n | tail -10
@dtateii
dtateii / wp-ssl-termination
Created April 3, 2015 19:34
Wordpress conf for SSL Termination at Load Balancer
/* Accept forwarded protocol from load balancer */
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'){
$_SERVER['HTTPS']='on';
}
@dtateii
dtateii / newsite_vagrant.sh
Created June 20, 2015 13:18
Interactive prompt for setting up directories on existing Vagrant boxes
#!/bin/bash
#
################################################
# Vagrant Local Site Configurator #
# Written by Brendan Corcoran, Dave Tate for NJI Media #
# #
# Usage: ./newsite.sh -OR- sh newsite.sh #
################################################
# Configure Vagrant/VM Sites directories