Skip to content

Instantly share code, notes, and snippets.

View goodtune's full-sized avatar

Gary Reynolds goodtune

  • Touch Technology
  • Central Coast, Australia
View GitHub Profile
@goodtune
goodtune / jock.json
Last active April 23, 2020 21:36
walk
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@goodtune
goodtune / README.md
Created February 18, 2019 21:07
Validate competition draw to ensure sufficient breaks between matches

match_minimum_break.py

This script will report on the match schedule for every team at the 2019 Touch World Cup to determine that there has been sufficient break time scheduled between fixtures.

It will report only on games with insufficient break between them - for example:

Men's Open      Netherlands            03/05/19 08:55   03/05/19 11:40  0d 2h 45m

Women's 27 Australia 30/04/19 13:30 30/04/19 16:15 0d 2h 45m

@goodtune
goodtune / README.md
Created November 28, 2018 10:47
Using a modern systemd to CentOS 7.x

Using a modern systemd on CentOS 7.x

Unfortunately the systemd that ships with CentOS 7.x is stalled at v219 - that is pretty old now, and there are some great features you're missing out on.

Thankfully facebookincubator/rpm-backports and https://copr.fedorainfracloud.org/coprs/jsynacek/systemd-backports-for-centos-7/ have come to the rescue!

Note: you really need to pay attention to the SELinux comment - if you don't disable it you're probably going to brick your host. Thankfully I tried this in a disposable vagrant first...

Disable SELinux

@goodtune
goodtune / compress_draw_format.py
Created September 7, 2018 01:51
Generate a "compressed" draw that will use byes from the last round to produce a draw for an odd number of teams without byes and equal number of games per day.
import sys
from first import first
from tournamentcontrol.competition.utils import round_robin
def compressed_round_robin(teams, rounds=None):
out = []
schedule = sorted(each for each in round_robin(teams))
for byes in schedule[-1][1:]:
@goodtune
goodtune / .gitignore
Last active October 19, 2017 23:27
How to run unit tests in parallel and produce JUnit XML output
report.xml
@goodtune
goodtune / README.md
Created August 10, 2017 08:10
Calculate suitable playing hours for sport for any point on the planet at any point in time.

daylight.py

This requires solartime==0.1b.

See test_daylight.py for an example.

etcd key watching test

You'll need three terminal windows.

etcd

Run an etcd single instance on default ports.

Try with both versions 2.3.x and 3.x

@goodtune
goodtune / README.md
Last active February 17, 2017 06:13
git tricks

git tricks

Things I've learned about git but don't use that often.

turn on colours

Wherever possible, use colours.

git config --global color.ui true
@goodtune
goodtune / mydo.py
Created February 25, 2016 23:07
ansible dynamic inventory for digital ocean
#!/usr/bin/env python
import json
import os
import sys
import digitalocean
manager = digitalocean.Manager(token=os.environ['DO_API_TOKEN'])
droplets = manager.get_all_droplets()
@goodtune
goodtune / tf
Created December 16, 2015 20:09
terraform wrapper to load contents of .vars to your environment
#!/bin/bash
# Use this script to load the contents of a .vars file in your current working
# directory into the environment before running terraform.
#
# Useful for avoiding numerous '-var "var=val"' options on the command line.
#
# Your .vars file should contain each var=val on a single line.
/usr/bin/env -S "$(sed -e 's/^/TF_VAR_/' .vars 2> /dev/null)" \