Instantly share code, notes, and snippets.

View affix-cloud

Keybase proof

I hereby claim:

  • I am affix on github.
  • I am affix ( on keybase.
  • I have a public key ASA4Cd2H8oxYYN_zve4TDWfADj1rArl11UD5HVhA-89wZgo

To claim this, I am signing this object:

View countries.json
"name": "Afghanistan",
"code": "AF"
"name": "Åland Islands",
"code": "AX"
View QRGen.swift
// ViewController.swift
// QRGen
// Created by Keiran Smith on 01/10/2016.
// Copyright © 2016 Keiran Smith. All rights reserved.
import Cocoa
import CoreImage
View tpbbot.rb
#!/usr/bin/env ruby
# Simple Pirate Bay Parser
# Checks the results page and lists torrents and info
# Also gives Magnet link
# (c) 2016 Keiran Smith
# Licensed under gnu/gplv3
require 'nokogiri'
require 'open-uri'
View UpdateASGroup.rb
#!/usr/bin/env ruby
# UpdateASGroup.rb
# Update AutoScaling Group with a new Image based from an running Instance
# (c) 2018 Keiran Smith <>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
View luamp.lua
outpin=4 -- Connect Relay trigger to pin D4
-- Relay powered from 3V pin
srv=net.createServer(net.TCP) srv:listen(80,function(conn)
View christmas_lights.rb
#!/usr/bin/env ruby
# Lights used are George Home 20 String Lights
# ASDA LED-20-BO (coloured) LED-20-BO-W (White/Clear)
require 'wiringpi'
puts "Pi Christmas Lights"
puts "Written by Affix"
puts "Created using ASDA George home 20 Battery string lights"

Mac OS X 10.11 El Capitan

Custom recipe to get OS X 10.11 El Capitan running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.10 Yosemite setup recipe (as found on this gist Note that I expect this to change significantly as I install El Capitan several times.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

View latlondistance.rb
def distance_between(lat1,lon1,lat2,lon2, miles=false)
r = 6371; # Kilometers
dLat = to_radian(lat2-lat1);
dLon = to_radian(lon2-lon1);
lat1 = to_radian(lat1);
lat2 = to_radian(lat2);
a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);