Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
contributing

Christopher Hopper christopher-hopper

:octocat:
contributing
View GitHub Profile
@christopher-hopper
christopher-hopper / phpenv-macos.sh
Last active Aug 4, 2020 — forked from eporama/phpenv-osx.sh
Install phpenv on macOS with homebrew php packages.
View phpenv-macos.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/JvG7i | bash
#
View keybase.md

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:

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

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)
@christopher-hopper
christopher-hopper / drush-site-alias-make.sh
Created Aug 6, 2015
Generate a drush site-alias record for the current Drupal site.
View drush-site-alias-make.sh
#!/bin/sh
drush --uri="http://$(hostname -f)" site-alias @self --alias-name="local" --show-passwords --with-db --with-optional
@christopher-hopper
christopher-hopper / persist-file-perms.md
Last active Oct 12, 2016
How to persist file system permissions for web applications.
View persist-file-perms.md

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
@christopher-hopper
christopher-hopper / xdebug-enable.sh
Last active Aug 25, 2016
Enable PHP xdebug by moving the /etc/php.d/*.ini
View xdebug-enable.sh
#!/usr/bin/env bash
# vim:sw=3 ts=6 ft=sh
# Uses BASH3 Boilerplate
# More info:
# - https://github.com/kvz/bash3boilerplate
# - http://kvz.io/blog/2013/02/26/introducing-bash3boilerplate/
#
# Version 1.0.0
#
# Usage:
@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
===========
@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
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.
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 / find-windows-process-listening-on-port.md
Last active Oct 8, 2018
Find Windows processes listening on a port
View find-windows-process-listening-on-port.md

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
christopher-hopper / clone-mysql-db.sh
Last active Oct 9, 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.
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}";
You can’t perform that action at this time.