Skip to content

Instantly share code, notes, and snippets.

No hair cutting during Covid19. Things are getting ... hairy!

Richard Quadling rquadling

No hair cutting during Covid19. Things are getting ... hairy!
  • Exeter, Devon, UK
View GitHub Profile
rquadling / Failed
Created May 15, 2020
Failed and successful install of AWS Cloudwatch Daemon using Ansible
View Failed
amazon-ebs: TASK [aws_cloudwatch_logs : Install the AWS CloudWatch Logs daemon] ************
amazon-ebs: task path: /tmp/packer-provisioner-ansible-local/5ebe8377-f9d0-f655-9be8-665b6e0204c8/roles/aws_cloudwatch_logs/tasks/install.yml:26
amazon-ebs: changed: [] => {"changed": true, "cmd": "python /tmp/ -n -r eu-west-1 -c /tmp/awslogs.conf", "delta": "0:00:25.998340", "end": "2020-05-15 12:12:01.446602", "rc": 0, "start": "2020-05-15 12:11:35.448262", "stderr": "", "stderr_lines": [], "stdout": "downloading AgentDependencies.tar.gz with urllib
rquadling /
Last active May 7, 2020
Get autoscaling group desired capacity within Terraform

My use case is to get the current desired capacity of an autoscaling group so that I can use that in the replacement autoscaling group. I've seen a Cloudformation solution, but that required more understanding than I have at the time.

Initially, I had thought that just returning the JSON from awscli would have been enough, but unfortunately, the result for the data_source.external.result is a list of strings. No numbers, arrays, maps, lists.

So inspired by a comment made by Marin Salinas, I found that Terraform can access local files!

In addition, I am using an assumed role to do the work.

rquadling / mb_str_pad.php
Last active Oct 15, 2021
Implementation of a multi-byte equivalent of PHP's str_pad function.
View mb_str_pad.php
* Multibyte String Pad
* Functionally, the equivalent of the standard str_pad function, but is capable of successfully padding multibyte strings.
* @param string $input The string to be padded.
* @param int $length The length of the resultant padded string.
* @param string $padding The string to use as padding. Defaults to space.
* @param int $padType The type of padding. Defaults to STR_PAD_RIGHT.
* @param string $encoding The encoding to use, defaults to UTF-8.
rquadling /
Last active Apr 23, 2019
ProMiReD - One of many different ways to manage migrations and code.


We needed a way to describe our pipeline deployment approach. How and when are things released. In what order do we modify the code and the database when it is not possible to do them all instantly.

And so we came up with this silly acronym. We know there are probably better approaches, but this has worked very well for us. To the point that our continuous integration and deployment pipelines can run all of these unattended, allowing our developers to develop and our reviewers to review and the poor release monkey can retire from running all those releases by hand.

Pro - Protect migrations

As migrations are developed and versioned using the current timestamp, and prior to Phinx 0.8, we needed to make sure that

rquadling / Dockerfile
Last active Oct 5, 2020
Adding XDebug to Bitnami's php-fpm container.
View Dockerfile
# An example Dockerfile to build a Bitnami PHP-FPM minimal container with xDebug and some other extensions installed.
# Please note, I have cobbled this together from limited understanding as well as dissecting the Dockerfiles that
# Bitnami have used.
# If you find problems, or suggestions, PLEASE PLEASE help me and the rest of the community with your comments,
# suggestions, fixes, etc. Let's all learn something new!!!!
# If you want to contact me directly, then RQuadling at the Google Mail, and I'll be happy to answer any questions.
View testCalculator.js
'use strict';
require(rootPath + '/src/js/lib/Calculator.js');
var calculatorDataProvider = {
'Empty calculator': {
amountDue: 0.00,
amountTenderedAfterAmountDueSet: 0.00,
changeGivenAfterAmountDueSet: 0.00,
amountTendered: 0.00,
rquadling /
Created Aug 24, 2017
Send an HTML message to HipChat using v1 of the api via cURL
<table><thead><tr><td colspan=\"2\"><b>Build starting</b></td></tr></thead>
<tr><td><b>Built for</b></td><td>${built_for}</td></tr>
<tr><td><b>Built by</b></td><td>${built_by}</td></tr>
curl -s -X POST \

Keybase proof

I hereby claim:

To claim this, I am signing this object:

rquadling / TestUTF8
Last active Aug 29, 2015
Testing PHP and unicode output.
View TestUTF8
REM Force UTF8
chcp 65001
REM Call the script again, as chcp doesn't affect THIS context.
CALL :UTF8ready %0
rquadling / gist_1.diff
Last active Dec 23, 2015
Patch to PHP to allow [SAPI] sections in INI files.
View gist_1.diff
diff --git a/main/main.c b/main/main.c
index 5942b23..e8171a5 100644
--- a/main/main.c
+++ b/main/main.c
@@ -2244,6 +2244,12 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
+ /* Activate SAPI specific section. */
+ if (php_ini_has_per_sapi_config() && {