Skip to content

Instantly share code, notes, and snippets.

Ryan Brooks spikeheap

Block or report user

Report or block spikeheap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@spikeheap
spikeheap / sessions.md
Last active Aug 20, 2017
Introduction to Coaching Workshop, Oxford 2017-08-12
View sessions.md

Workshop sessions

First we split into groups of 5 and asked:

What experience do you have of coaching or mentoring? What’s the difference between mentoring and coaching?

Session 1

Once we’d committed to confidentiality and making the workshop a safe space, in pairs we covered:

What is it like doing your job?

View seed_dependencies.sh
# Requires the following environment variables:
#
# - COMMIT_REF
# - GITHUB_OAUTH_TOKEN
source .env.docker
curl -s -H "Authorization: token $GITHUB_OAUTH_TOKEN" "https://api.github.com/repos/growkudos/growkudos/contents/Gemfile?ref=$COMMIT_REF" \
| jq '.content' --raw-output \
| base64 --decode \
> Gemfile
View build.log
root@58857b49d831:/openMVS_build# make -j2
Scanning dependencies of target Common
[ 1%] Building CXX object libs/Common/CMakeFiles/Common.dir/Timer.cpp.o
[ 3%] Building CXX object libs/Common/CMakeFiles/Common.dir/Common.cpp.o
In file included from /openMVS/libs/Common/Types.h:357:0,
from /openMVS/libs/Common/Common.h:176,
from /openMVS/libs/Common/Timer.cpp:8:
/openMVS/libs/Common/HalfFloat.h: In static member function 'static short int SEACAVE::hfloat::fromFloat(float)':
/openMVS/libs/Common/HalfFloat.h:62:29: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
const int& fltInt32((int&)fv);
@spikeheap
spikeheap / test.rb
Last active Jan 2, 2017
Rails Docker DB with migrations
View test.rb
#/config/environments/test.rb
require 'docker'
Rails.application.configure do
config.after_initialize do
logger.info "db:migrate"
ActiveRecord::Migrator.migrate(Rails.root.join("db/migrate"), nil)
end
@spikeheap
spikeheap / env_var_perf_test.php
Created Nov 17, 2016
A naïve perftest of EmonCMS settings logic
View env_var_perf_test.php
<?php
// 10,000,000
$run_count = 10000000;
$start_time = time();
for ($i = 0; $i < $run_count; $i++) {
//1 #### Mysql database settings
if (isset($_ENV["MYSQL_HOST"])) $server = $_ENV["MYSQL_HOST"];
if (isset($_ENV["MYSQL_DATABASE"])) $database = $_ENV["MYSQL_DATABASE"];
@spikeheap
spikeheap / stdin_reader.rb
Last active Jun 29, 2016
Reading STDIN with threads in Ruby
View stdin_reader.rb
require 'thread'
queue = Queue.new
producer = Thread.new do
loop do
key = STDIN.getch
queue << key if key
end
end
@spikeheap
spikeheap / Dockerfile
Created Apr 29, 2016
Nginx HTTPS proxy for Rails
View Dockerfile
FROM alpine:3.2
MAINTAINER ryan@slatehorse.com
RUN apk add --update nginx openssl && rm -rf /var/cache/apk/*
COPY ./nginx.conf /etc/nginx/nginx.conf
# Generate certificates
ENV CERTIFICATE_DIR=/usr/local/app/certs
@spikeheap
spikeheap / add_m_attribute.xsl
Last active Nov 9, 2015
Add `m` attribute to all leaf nodes
View add_m_attribute.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0"
xmlns:d="http://nihr.ac.uk/nhic/ICU/UCL/finalv8.3.2">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="dateNow" select="format-date(current-date(), '[Y0001]-[M01]-[D01]')"/>
<xsl:template match="node()|@*">
View linting.sh
export XMLLINT_FILE=xmllint_20151103_1930.log
xmllint --schema docs/NHIC_ICU_v8.3.2-Final.xsd --noout docs/output/NIHRHIC_CC_8.3.2_Oxford\ 03112015.xml 2>&1 | grep -v "The attribute 'm' is required but missing." > $XMLLINT_FILE
# get an overview of the failure counts
cut -d':' -f3 $XMLLINT_FILE | sort | uniq -c | sort
# lookup a particular error (_0085 in this case):
cat $XMLLINT_FILE | grep _0085 | cut -d: -f7 | sort -u
@spikeheap
spikeheap / README.md
Last active Oct 8, 2015
Git Flow start the day
View README.md

Add this function to your ZSH/BASH init to do a sane update of develop and master. Handy when you come back to a project after a couple of days.

Note that this doesn't merge develop into your current branch, but I'll leave that to you to add if you need it :).

You can’t perform that action at this time.