Skip to content

Instantly share code, notes, and snippets.

View AndrewFarley's full-sized avatar

Farley Farley (yes, really) AndrewFarley

  • New Plymouth, New Zealand
View GitHub Profile
@AndrewFarley
AndrewFarley / tf
Created August 11, 2016 19:34 — forked from MrPink/tf
Elasticache replication group with Cloudformation and controlled by Terraform
resource "template_file" "cf" {
vars {
cluster_name = "${var.cluster_name}"
csg_name = "${aws_elasticache_subnet_group.default_redis_sg.name}"
cluster_internal_sg_id = "${module.ecs-cluster.cluster_internal_sg_id}"
}
template = <<STACK
{
"Resources" : {
@AndrewFarley
AndrewFarley / all_aws_managed_policies.json
Created May 21, 2018 16:37 — forked from gene1wood/all_aws_managed_policies.json
A list of all AWS managed policies and they're policy documents as well as a short script to generate the list
{
"AWSAccountActivityAccess": {
"Arn": "arn:aws:iam::aws:policy/AWSAccountActivityAccess",
"AttachmentCount": 0,
"CreateDate": "2015-02-06T18:41:18+00:00",
"DefaultVersionId": "v1",
"Document": {
"Statement": [
{
"Action": [
@AndrewFarley
AndrewFarley / macos-recovery-server.md
Created May 25, 2018 10:29
Fixing "The recovery server could not be contacted" in MacOS High Sierra

I was trying to reinstall High Sierra on an older MacBook Air using internet recovery and I kept on getting an error message when trying to reinstall High Sierra.

The recovery server could not be contacted

It appears that this has to do with the time on the machine not being synchronized, so when the MacBook tries to reach out to the recovery server the certificates do not validate and we get this useless error message.

To fix this.

  1. Open up a Terminal from the utilities menu
  2. Enter the following command
@AndrewFarley
AndrewFarley / autossh.service
Created May 30, 2018 08:44 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@AndrewFarley
AndrewFarley / sigterm.py
Created June 7, 2018 12:48 — forked from honza/sigterm.py
Sigterm handler in Python
"""
This snippet shows how to listen for the SIGTERM signal on Unix and execute a
simple function open receiving it.
To test it out, uncomment the pid code and kill the process with:
$ kill -15 pid
"""
import signal
import sys
@AndrewFarley
AndrewFarley / Ubuntu 16.04
Created July 4, 2018 21:37 — forked from dhoeric/Ubuntu 16.04
install-docker-aws-ec2-user-data
#!/bin/bash
# Install docker
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update
@AndrewFarley
AndrewFarley / usb_hid_keys.h
Created January 13, 2022 10:25 — forked from MightyPork/usb_hid_keys.h
USB HID Keyboard scan codes
/**
* USB HID Keyboard scan codes as per USB spec 1.11
* plus some additional codes
*
* Created by MightyPork, 2016
* Public domain
*
* Adapted from:
* https://source.android.com/devices/input/keyboard-devices.html
*/