Skip to content

Instantly share code, notes, and snippets.

View heywoodlh's full-sized avatar
:octocat:
Trapped in Vim

Spencer Heywood heywoodlh

:octocat:
Trapped in Vim
View GitHub Profile
@heywoodlh
heywoodlh / wp-replace-sql-url
Last active January 14, 2017 14:02
sql script that finds old URL in database and replaces it with new URL
UPDATE wp_options SET option_value = replace(option_value, 'http://travelspective.com', 'http://localhost/tsbuild/build') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://travelspective.com', 'http://localhost/tsbuild/build');
UPDATE wp_posts SET post_content = replace(post_content, 'http://travelspective.com', 'http://localhost/tsbuild/build');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://travelspective.com', 'http://localhost/tsbuild/build');
@heywoodlh
heywoodlh / weblogin.sh
Created May 8, 2017 00:57
Simple bash script that logs user into desired website
#!/usr/bin/env bash
help_message() {
echo "Usage: $0 'username' 'password' 'https://urltologin.com'"
}
if [ -z $1 ]
then
help_message
exit 2
@heywoodlh
heywoodlh / headless-vbox.sh
Created May 8, 2017 14:40
headless-vbox script
#!/usr/bin/env bash
#Requirements:
# 1. ssh needs to be running on vm
# 2. VM_NAME and USER variable need to be set
#Set these variables (VM_NAME should equal the name of your virtualbox vm, USER should equal the name of your vm username)
VM_NAME=""
@heywoodlh
heywoodlh / clean-up.ps1
Created May 8, 2017 14:42
simple powershell that downloads tools for cleaning up Windows desktop, runs them and then removes them
<# REMEMBER TO SetExecutionPolicy Unrestricted -Force #>
<# Download tech tools #>
#!/usr/bin/env bash
IP=$(sudo arp-scan --localnet --numeric --quiet --ignoredups | grep -E '([a-f0-9]{2}:){5}[a-f0-9]{2}' | awk '{print $1}')
echo $IP | fmt -w 1
@heywoodlh
heywoodlh / tarsnap-backup-notification.sh
Last active October 6, 2020 18:14
Tarsnap backup script
#!/usr/bin/env bash
## This script assumes that ssmtp is already configured on the server.
KEYFILE="/tmp/tarsnap.key"
EMAIL="[email protected]"
BACKUP_NAME="$(uname -n)-server-backup-$(date +%Y-%m-%d_%H-%M-%S)"
DATA_PATH="/tmp/path1 /tmp/path2"
TOTAL_BACKUPS='3'
EXCLUDE="" #space separated paths if you need multiple exclusions
@heywoodlh
heywoodlh / generic-portforward.sh
Last active August 22, 2017 20:51
Simple port forwarding script via SSH
#!/usr/bin/env bash
PORT='80'
SSH_PORT='22'
USERNAME='root'
HOSTNAME='myserver.com'
if ssh -p "$SSH_PORT" -t -t -L 9000:127.0.0.1:"$PORT" "$USERNAME"@"$HOSTNAME" &
then
SSH_PID=$(echo $!)
sleep 5
#!/bin/bash
################################
# OS X Install ISO Creater #
# #
# Author: shela #
################################
#######################################
# Declarations
@heywoodlh
heywoodlh / password-change.ps1
Last active September 29, 2017 16:58
Active Directory Password Changing Script
$domainServer = 'ad.mydomain.com'
$username = Read-Host -Prompt 'Username: '
$newPassword = Read-Host -AsSecureString -Prompt 'Password: '
Set-ADAccountPassword -Identity $username -Reset -NewPassword $newPassword
@heywoodlh
heywoodlh / account-lookup.ps1
Created August 31, 2017 16:02
Active Directory Account Lookup
$domainServer = 'ad1.mydomain.com'
$user = Read-Host -Prompt 'Last Name: '
get-aduser -f {SurName -eq $User}