Skip to content

Instantly share code, notes, and snippets.

View affix's full-sized avatar
:shipit:
Code never lies, Comments might though

Keiran Smith affix

:shipit:
Code never lies, Comments might though
View GitHub Profile

Keybase proof

I hereby claim:

  • I am affix on github.
  • I am affix (https://keybase.io/affix) on keybase.
  • I have a public key ASA4Cd2H8oxYYN_zve4TDWfADj1rArl11UD5HVhA-89wZgo

To claim this, I am signing this object:

[
{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Åland Islands",
"code": "AX"
},
{
@affix
affix / QRGen.swift
Created October 16, 2016 12:47
View Controller to Generate a QR Code with swift on macOS. Requires a NSImageView, NSTextField and NSButton
//
// ViewController.swift
// QRGen
//
// Created by Keiran Smith on 01/10/2016.
// Copyright © 2016 Keiran Smith. All rights reserved.
//
import Cocoa
import CoreImage
@affix
affix / tpbbot.rb
Last active October 14, 2016 10:29
A simple Pirate Bay Scraper that only scrapes a single page
#!/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'
@affix
affix / UpdateASGroup.rb
Last active July 15, 2018 19:23
A ruby script to update your AutoScaling Group by taking an image of an existing instance
#!/usr/bin/env ruby
# UpdateASGroup.rb
# Update AutoScaling Group with a new Image based from an running Instance
# (c) 2018 Keiran Smith <opensource_at_keiran.scot>
# 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,
wifi.setmode(wifi.STATION)
wifi.sta.config("SSID","PASSWORD")
print(wifi.sta.getip())
outpin=4 -- Connect Relay trigger to pin D4
-- Relay powered from 3V pin
srv=net.createServer(net.TCP) srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
#!/usr/bin/env ruby
# GNU/GPL V3+
# 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"
@affix
affix / osx-10.11-setup.md
Created November 20, 2015 17:26 — forked from jrgcubano/osx-10.11-setup.md
Mac OS X 10.11 El Capitan Setup

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 https://gist.github.com/kevinelliott/0726211d17020a6abc1f). 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.

@affix
affix / latlondistance.rb
Created November 10, 2015 03:03
Calculate the distance between two GPS Co-Ordinates with Ruby
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);

Keybase proof

I hereby claim:

  • I am Affix on github.
  • I am affix (https://keybase.io/affix) on keybase.
  • I have a public key whose fingerprint is B143 C0B3 D2C8 158D 0DFF 7CB0 3DF1 24CD EDE8 E0CA

To claim this, I am signing this object: