Skip to content

Instantly share code, notes, and snippets.

View Stubbs's full-sized avatar

Stuart Grimshaw Stubbs

  • Sheffield, South Yorkshire, UK
View GitHub Profile
@Stubbs
Stubbs / pre-commit
Created January 17, 2012 10:30
pre-commit hook to stop you commiting broken tests.
#!/bin/sh
# Script to check the status of the last test run & cancel the commit if there are any errors or failures
RESULTS="tests/reports/testsuites.xml"
# Check the test results exist, and have results in them.
if [ ! -s $RESULTS ]
then
echo "WTF is this shit? You've not even tried to run the tests. You suck, man."
@Stubbs
Stubbs / install_jenkins.sh
Created February 3, 2012 10:35
Script to install everything you need for PHP CI on a Debian box.
#!/bin/bash
## Install Git #########################################
apt-get install git
## Install Ant #########################################
apt-get install ant
## Install Jenkins #####################################
@Stubbs
Stubbs / behat.sh
Created November 23, 2011 14:17
Behat Bash Autocompletion
#
# Add this to your /etc/bash_completion.d directory for behat parameter auto completion.
#
_behat()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@Stubbs
Stubbs / main.yml
Created March 28, 2015 14:31
Ansible Playbook to install PHP7
- name: Install Packages Needed To Compile PHP 7
apt: pkg={{ item }} state=latest
with_items:
- git
- autoconf
- bison
- libxml2-dev
- libbz2-dev
- libmcrypt-dev
- libcurl4-openssl-dev
actionid: py37
msg: getenv
cmdargs: ['/usr/bin/env', 'LANG=C.UTF-8', 'pip', 'install', '-r/Users/stuart/Projects/HomeAssistant/home-assistant/requirements_test_all.txt', '-c/Users/stuart/Projects/HomeAssistant/home-assistant/homeassistant/package_constraints.txt']
Collecting asynctest==0.12.2 (from -r /Users/stuart/Projects/HomeAssistant/home-assistant/requirements_test_all.txt (line 5))
Using cached https://files.pythonhosted.org/packages/ee/29/9a9289a11b56ceb28dc18fc5b1af9b4223a387269252bb0f349c9da2ed10/asynctest-0.12.2-py3-none-any.whl
Collecting coveralls==1.2.0 (from -r /Users/stuart/Projects/HomeAssistant/home-assistant/requirements_test_all.txt (line 6))
Using cached https://files.pythonhosted.org/packages/7e/26/7a820800615866b624cb5612f7f661405f713b2292cd94ace8b648705747/coveralls-1.2.0-py2.py3-none-any.whl
Collecting flake8-docstrings==1.3.0 (from -r /Users/stuart/Projects/HomeAssistant/home-assistant/requirements_test_all.txt (line 7))
Using cached https://files.pythonhosted.org/packages/4e/a
@Stubbs
Stubbs / bootstrap.php
Created May 26, 2013 00:22
Isolate unit tests in Symfony2 http://php-and-symfony.matthiasnoback.nl/2011/10/symfony2-use-a-bootstrap-file-for-your-phpunit-tests-and-run-some-console-commands/ and then use this as your bootstrap to load migrations & fixtures.
<?php
require_once __DIR__ . '/bootstrap.php.cache';
require_once __DIR__ . '/AppKernel.php';
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Input\ArrayInput;
use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
NAME=/mnt/hendry/media/Videos/cctv/cctv
if [[ -e $NAME.h264 ]] ; then
i=0
while [[ -e $NAME-$i.h264 ]] ; do
let i++
done
NAME=$NAME-$i
fi
/usr/bin/raspivid -n -t 30000 -o $NAME.h264
#!/bin/sh
# Download to your project's .git/hooks/prepare-commit-msg and make it executable.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
@Stubbs
Stubbs / Debounce Node
Created December 22, 2016 14:22
Debounce node for Node Red.
// A little function to debounce messages
// that tend to flip flop a lot
// Uses the message topic as the key.
var debounceTracker = global.get("debounceTracker");
if (!debounceTracker) {
debounceTracker = {};
}
@Stubbs
Stubbs / multitail.conf
Last active February 12, 2016 08:50
Basic Multitail config for colourising Symfony2 log files.
colorscheme:symfony
cs_re:cyan:^\[....-..-.. ..:..:..\]
cs_re:blue: .*\.(INFO|NOTICE).*
cs_re:red: .*\.(ERROR|CRITICAL).*
cs_re:blue: \{[^}]+\}