Skip to content

Instantly share code, notes, and snippets.

View b3cft's full-sized avatar

Andrew "Bob" Brockhurst b3cft

View GitHub Profile
@b3cft
b3cft / mermaid markdown example
Created August 14, 2021 11:33
Example infra difagram done in mermaid
```mermaid
graph TB;
subgraph "External"
ct{commercetools}
user((User))
end
subgraph "AWS Live"
subgraph "Servers";
@b3cft
b3cft / Makefile
Last active March 10, 2020 16:38
Makefile automagic help
SHELL=bash
.DEFAULT=help
ifndef VERBOSE
.SILENT:
endif
# Colours
NO_COLOUR=\033[0m
OK_COLOUR=\033[1;32m
INFO_COLOUR=\033[1;33m
SECTION_COLOUR=\033[1;37m
@b3cft
b3cft / Jenkinsfile
Created February 15, 2019 07:46 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage concurrency constraints, ...
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
/*
Please make sure to add the following environment variables:
HEROKU_PREVIEW=<your heroku preview app>
HEROKU_PREPRODUCTION=<your heroku pre-production app>
HEROKU_PRODUCTION=<your heroku production app>

Keybase proof

I hereby claim:

  • I am b3cft on github.
  • I am b3cft (https://keybase.io/b3cft) on keybase.
  • I have a public key ASDjhpy5yb6HkoZyUQAvurJtzHs8lR1euD9qoN1VdHSkmgo

To claim this, I am signing this object:

@b3cft
b3cft / Makefile
Created September 15, 2017 15:58
AWS CloudFormation Makefile
.PHONY: help sync update-stack update-all create-stack
.DEFAULT: help
SHELL=bash
ifndef VERBOSE
.SILENT:
endif
DONE = echo ✓ $@ done
ALL = uat1 uat2 uat3 uat4 uat5
AMI=`aws --region=eu-west-1 --profile=mgmt --output=text ec2 describe-images \
--filter "Name=tag:Name,Values=AMI_TAG_OF_CHOICE" --owners YOUR_AWS_ACCOUNT_ID_HERE \
@b3cft
b3cft / gist:3754524
Created September 20, 2012 07:56
Add header to requests on a sample rate
// at head of vcl
C{
static __thread struct drand48_data random_seed;
static long int sample_rate = 1000;
}C
// in vcl recv
C{
long int r;
lrand48_r(&random_seed, &r);
#! /usr/bin/env php
<?php
if ($_SERVER['argc'] != 2) {
printf("%s: Converts assertType() into assertInternalType() or assertInstanceOf()\n\n", basename(__FILE__));
printf("Usage: %s <tests directory>\n", basename(__FILE__));
exit(11);
}
$directories = new RegexIterator(
new RecursiveIteratorIterator(
/**
* Once every few years, a jobbing programmer must commit an act of great evil.
*
* See the following bug for why this massive heap of fail exists.
*
* http://bug.corp.yahoo.com/show_bug.cgi?id=3505022&mark=6#c6
*
*/
private function generateUrlByUsingEvil($show)
{