Skip to content

Instantly share code, notes, and snippets.

:octocat:
contributing

Christopher Hopper christopher-hopper

:octocat:
contributing
Block or report user

Report or block christopher-hopper

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
@christopher-hopper
christopher-hopper / wget-curl-response-headers.sh
Last active Nov 13, 2019
RESTful API testing response headers using wget or curl
View wget-curl-response-headers.sh
# RESTful API testing
# wget
# - method: GET
# - output: response headers only
wget --server-response --quiet \
--output-document=/dev/null --output-file=- \
https://example.com/api/endpoint
View README.md

SSH Config

This is an example ~/.ssh/config file showing a common set-up with the following features:

  1. SSH Agent key forwarding into local virtual machines
  2. SSH Agent key forwarding into remote Acquia servers
  3. SSH alias for a personal bitbucket.org account (uses a different SSH key)
  4. Keychain Access configuration for macOS
@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
Last active Oct 30, 2019
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.
View vm-resize-hard-disk.md

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@christopher-hopper
christopher-hopper / fix-rabbitmq-after-disk-space-full.markdown
Created Mar 25, 2014
How to recover RabbitMQ after running out of disk space
View fix-rabbitmq-after-disk-space-full.markdown

If RabbitMQ wont start and show the following in the startup logs:

# cat  /var/log/rabbitmq/startup_log


BOOT FAILED
===========
View macos-sudoers-vagrant-plugin
# vagrant-hostmanager https://github.com/devopsgroup-io/vagrant-hostmanager
Cmnd_Alias VAGRANT_HOSTMANAGER_UPDATE = /bin/cp /home/*/.vagrant.d/tmp/hosts.local /etc/hosts
%admin ALL=(root) NOPASSWD: VAGRANT_HOSTMANAGER_UPDATE
# See https://github.com/cogitatio/vagrant-hostsupdater#readme
# vagrant plugin vagrant-hostsupdater.
Cmnd_Alias VAGRANT_HOSTS_ADD = /bin/sh -c echo "*" >> /etc/hosts
@christopher-hopper
christopher-hopper / phpenv-osx.sh
Last active Jul 20, 2019 — forked from eporama/phpenv-osx.sh
Install phpenv on macOS with homebrew php packages.
View phpenv-osx.sh
#!/usr/bin/env bash
# vim: ai ts=2 sw=2 et sts=2 ft=sh
# Install or re-install phpenv with
# multiple versions of PHP on macOS.
#
# Usage:
#
# curl -L https://git.io/v52yY | bash
#
@christopher-hopper
christopher-hopper / valid-jira-ticket-match-regex.md
Last active Jul 16, 2019
Perl-compatible regular expression to find valid JIRA ticket id in a commit message.
View valid-jira-ticket-match-regex.md

Yet another commit message check

Check a Git commit message, for a valid JIRA ticket, using a Perl compatible regular expression match.

  • Anywhere in the message
  • Looks like MSG-100 EG_MSG-100 MESG-100
  • Doesn't look like MSG-000 MSG-01 MSG-1234

NOTE: Will not work with valid ticket id ending in '-123'

@christopher-hopper
christopher-hopper / clone-mysql-db.sh
Last active Jun 12, 2019
Clone a MySQL database to a new database on the same server without using a dump file. This is much faster than using mysqldump.
View clone-mysql-db.sh
#!/bin/bash
DBUSER="root";
DBPASS="";
DBHOST="localhost";
DB_OLD=mydatabase
DB_NEW=clone_mydatabase
DBCONN="--host=${DBHOST} --user=${DBUSER} --password=${DBPASS}";
@christopher-hopper
christopher-hopper / git-remote-merged.sh
Created Jun 7, 2019
Delete remote branches that have been merged to master.
View git-remote-merged.sh
#!/usr/bin/env bash
# vim: ai ts=2 sw=2 et sts=2 ft=sh
# Delete remote branches that have been merged to master.
#
# Usage:
#
# git-remote-merged.sh -f
#
@christopher-hopper
christopher-hopper / phpenv-ubuntu-xenial.sh
Last active Apr 25, 2019
Install phpenv on Ubuntu 16.04 LTS (xenial)
View phpenv-ubuntu-xenial.sh
#!/usr/bin/env bash
# vim: ai ts=2 sw=2 et sts=2 ft=sh
# Check OS.
if [[ ! "${OSTYPE}" =~ "^linux" ]] || [[ ! "$(lsb_release -c 2>/dev/null)" =~ "xenial" ]]; then
(>&2 echo "Error: This script is for Ubuntu 16.04 LTS (xenial) not '${OSTYPE}'.")
exit 1;
fi
sudo apt-get update
You can’t perform that action at this time.