Skip to content

Instantly share code, notes, and snippets.

View christopher-hopper's full-sized avatar
:octocat:
contributing

Christopher Hopper christopher-hopper

:octocat:
contributing
View GitHub Profile
@christopher-hopper
christopher-hopper / domains-test.sh
Last active November 16, 2018 03:40
Read domains from a file and follow each using an HTTP GET request
#!/usr/bin/env bash
# -----
# Read domains from a file and test HTTP GET request.
#
set -o errtrace
set -o pipefail
set -o errexit
set -o nounset
@christopher-hopper
christopher-hopper / macos-desktop-finder-toggle.sh
Last active November 21, 2018 05:23
macOS Desktop Finder Files Toggle
#!/bin/bash
# vim: ai ts=2 sw=2 et sts=2 ft=sh
#
# macOS Desktop Finder Files Toggle
#
# Toggle the use of Finder to display the contents of the Desktop folder as
# icons on the macOS desktop. Hides or Shows all Finder files icons on the
# Desktop.
#
# https://ss64.com/osx/defaults.html
@christopher-hopper
christopher-hopper / git-remote-merged.sh
Created June 7, 2019 08:31
Delete remote branches that have been merged to master.
#!/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 / valid-jira-ticket-match-regex.md
Last active July 16, 2019 01:40
Perl-compatible regular expression to find valid JIRA ticket id in a commit message.

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 / wget-curl-response-headers.sh
Last active November 13, 2019 23:24
RESTful API testing response headers using wget or curl
# 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
@christopher-hopper
christopher-hopper / clone-mysql-db.sh
Last active January 15, 2021 17:16
Clone a MySQL database to a new database on the same server without using a dump file. This is much faster than using mysqldump.
#!/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 / README.md
Last active January 18, 2022 03:50
macOS Amazee.io Drupal example Docker Compose override

macOS Amazee.io Drupal example Docker Compose override

Override Docker Compose volumes in an Amazee.io Drupal example to use NFS mounts.

This can substantially improve the disk I/O performance when running disk heavy operations inside Docker containers. Specifically, we're looking to improve performance for operations like php composer install and composer update.

@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
Last active April 5, 2022 10:30
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

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:

# 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 / fix-rabbitmq-after-disk-space-full.markdown
Created March 25, 2014 04:56
How to recover RabbitMQ after running out of disk space

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

# cat  /var/log/rabbitmq/startup_log


BOOT FAILED
===========