Skip to content

Instantly share code, notes, and snippets.


Christopher Hopper christopher-hopper

View GitHub Profile
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 Feb 11, 2020
Clone a MySQL database to a new database on the same server without using a dump file. This is much faster than using mysqldump.
DBCONN="--host=${DBHOST} --user=${DBUSER} --password=${DBPASS}";
christopher-hopper /
Last active Oct 8, 2018
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 "\"") } '
christopher-hopper /
Last active Sep 20, 2020
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:

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

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

You can’t perform that action at this time.