Skip to content

Instantly share code, notes, and snippets.


Christopher Hopper christopher-hopper

View GitHub Profile
christopher-hopper /
Created Aug 6, 2015
Generate a drush site-alias record for the current Drupal site.
drush --uri="http://$(hostname -f)" site-alias @self --alias-name="local" --show-passwords --with-db --with-optional
christopher-hopper / gist:5368555
Created Apr 12, 2013
JetBrains PhpStorm Exeption in plugin Ini4Idea v 1.0.6
View gist:5368555
JetBrains PhpStorm Exeption in plugin Ini4Idea
PhpStorm version 6.0
Ini4Idea version 1.0.6
What was I doing when it occurred:
I have configured *.info to be treated as an INI file. I have a file named open for editing.
I don't know when the exception error message first appeared, but as soon as I noticed it I sent this debug information. As a result, I'm not sure what I was doing when the exception happened.
christopher-hopper / gist:6052008
Last active Dec 20, 2015
Generate a `.gitattributes` file
View gist:6052008
# Find text files with this command
grep -r -m 1 "^" . \
| grep -v "^Binary file" \
| gawk 'BEGIN { FS=":" } { print $1 }' \
| sed -re 's:.+\.([^\.]+)$:*.\1 text eol=lf:g' -e '/\//d' \
| sort -u
christopher-hopper / gist:6118414
Last active Dec 20, 2015
Kill the processes and back-up accounts before removing
View gist:6118414

Remove Linux user accounts

I killed the processes and backed-up old accounts on the Peregrine UAT server You can find tarballs for the home folders of all removed accounts on Peregrine UAT at:

To remove accounts safely I did the following:

  1. Lock the account.
christopher-hopper /
Last active Dec 28, 2015
Reset the groups for all users matching "" to be primary group "developers", supplementary group ""
function usage() {
echo -e "Usage: " 1>&2;
echo -e "\t${0} [-h|-f|-i]" 1>&2;
echo -e "Description: " 1>&2;
echo -e "\tReset all users to have \`developer' as their primary group" 1>&2;
while getopts ":hfi" FLAG; do
case "${FLAG}" in
christopher-hopper /
Last active Aug 25, 2016
Enable PHP xdebug by moving the /etc/php.d/*.ini
#!/usr/bin/env bash
# vim:sw=3 ts=6 ft=sh
# Uses BASH3 Boilerplate
# More info:
# -
# -
# Version 1.0.0
# Usage:
christopher-hopper /
Last active Oct 12, 2016
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

View fatal_error_on_8.2.x-2903942-3.patch
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;

Keybase proof

I hereby claim:

  • I am christopher-hopper on github.
  • I am chop ( on keybase.
  • I have a public key ASBUM3iCrJK9V9U_hmodhM-GRmWCGilGwpyN2KpEOWyjnQo

To claim this, I am signing this object:

christopher-hopper /
Last active Mar 20, 2018
Install PHP from a source download to enable its interactive command-line shell interface on Linux.

PHP Interactive CLI Install

The following commands can be used to install PHP from source with an interactive command-line shell interface on Linux.

This interactive shell, (command: php -a) was the main reason I built from source to begin with. Now though I am able to play with the latest PHP versions as soon as they are available.

The commands below were written for and tested on the following system.

  • OS: Ubuntu 14.04.4 LTS (trusty)
You can’t perform that action at this time.