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 / 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 / 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 / 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 / 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 / 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 / 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 / find-windows-process-listening-on-port.md
Last active October 8, 2018 18:34
Find Windows processes listening on a port

Windows processes listening on a port

These examples assume you are using Windows 7 and have Cygwin installed with the awk package.

This single command will identify the process listening on port "2222" by feeding netstat output into tasklist using gawk.

netstat -aon | gawk ' $2~/:2222/ { system("tasklist /svc /FI \"PID eq " $5 "\"") } '

Keybase proof

I hereby claim:

  • I am christopher-hopper on github.
  • I am chop (https://keybase.io/chop) on keybase.
  • I have a public key ASBUM3iCrJK9V9U_hmodhM-GRmWCGilGwpyN2KpEOWyjnQo

To claim this, I am signing this object:

diff --git a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php
index 87465ca06f..377d36f84e 100644
--- a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php
+++ b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php
@@ -4,6 +4,7 @@
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableMetadata;
+use Drupal\Core\Entity\EntityInterface;
use Drupal\views\Plugin\views\PluginBase;
@christopher-hopper
christopher-hopper / persist-file-perms.md
Last active October 12, 2016 05:16
How to persist file system permissions for web applications.

Persist Filesystem Permissions

The writable files and folders for web applications often require specific user, group and permission masks to persist, even when new files and sub-folders are added by users or the application itself.

For example, permissions might need to be:

File mode

u:rw,g:rw