Skip to content

Instantly share code, notes, and snippets.

View colin-nolan's full-sized avatar

Colin Nolan colin-nolan

View GitHub Profile
@colin-nolan
colin-nolan / wsgi_server.py
Last active March 7, 2018 10:43
Controller for Python WSGI server
# Copyright (c) 2018 Genome Research Limited
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
@colin-nolan
colin-nolan / speed-checker.sh
Created September 16, 2017 16:23
Periodically logs the Internet speed (requires `speedcheck` CLI)
#!/bin/bash
set -euf -o pipefail
# Note: jitter is not removed
PERIOD_IN_SECONDS=3600
while true
do
# To install `speedtest`: `pip install speedtest-cli`
@colin-nolan
colin-nolan / install-git-subrepo.sh
Last active February 13, 2018 04:04
Install Git Subrepo
apt-get update \
&& apt-get install -y --no-install-recommends \
less \
git
git clone --depth=1 --branch=0.3.1 https://github.com/ingydotnet/git-subrepo.git /tmp/git-subrepo \
&& cd /tmp/git-subrepo \
&& make install \
&& cd - \
&& rm -rf /tmp/git-subrepo
@colin-nolan
colin-nolan / kill-docker-machines.sh
Last active July 21, 2017 14:56
Force kills all Docker machines
docker-machine ls -q | while read machineName; do
docker-machine rm -f "$machineName"
done
# In Debian-world, cron.daily runs at a random time. This is an ansible task to
# change it to run at an hour specified by `cron_daily_time`.
- name: Change cron.daily to run at a specified time
become: yes
replace:
path: /etc/crontab
regexp: '(\S*[ \t])(\S*)([ \t].*cron\.daily)'
replace: '\g<1>{{ cron_daily_time }}\g<3>'
@colin-nolan
colin-nolan / pip-install-ansible.sh
Last active March 21, 2017 10:30
Install/Update Ansible from PyPi
# Install pip
apt-get install -y python-pip
# Install dependencies for cryptography (dependency of ansible)
apt-get install -y build-essential libssl-dev libffi-dev python-dev
# Install/Update Ansible
pip install -U ansible