Skip to content

Instantly share code, notes, and snippets.

View thepatrick's full-sized avatar
🌈
Hi

Patrick Quinn-Graham thepatrick

🌈
Hi
View GitHub Profile
import Cocoa
public enum TagErrors: LocalizedError, CaseIterable {
case InvalidCallingConvention
var localizedDescription: String {
switch self {
case .InvalidCallingConvention: return "A closure was called with an invalid calling convention, probably (nil, nil)"
}
}
#!/bin/bash
adduser patrick
adduser patrick admin
su - patrick -c "mkdir -p ~/.ssh && curl --silent https://github.com/thepatrick.keys > .ssh/authorized_keys"
@thepatrick
thepatrick / main.tf
Last active July 7, 2020 11:00
cidrsubnet magic
module "anvil" {
source = "./subnets"
cidr_block = "10.192.12.0/22"
subnet_mask = 24
}
output "size" {
value = "${module.anvil.size}"
}
#!/usr/bin/env bash
function usage {
echo -e "\nusage: $0 [src_dir] [dest_dir] [tmp_dir]\n"
exit 1
}
if [[ $# != 3 || $@ == "--help" ]]
then
usage
@thepatrick
thepatrick / README.md
Last active September 30, 2018 12:07
Experiments with MLVPN

This is how I got MLVPN working for me. I say working, but it's a work in progress really.

Based heavily on Linux with two ADSL uplinks for agregation and failover.

0. Assumptions:

  1. Server & Client are both running Ubuntu 18.04, 64bit intel.
  2. Server is on AWS. It's public IP is 52.62.1.227, private IP is 172.31.19.54 & the VPC is 172.31.0.0/16
  3. The client has three networks:
    1. 10.0.111.0/24 (upstream 1)
#!/bin/bash
# Currently missing: install GPG Tools &
mkdir -p ~/Developer
cd ~/Developer
git clone git@github.com:thepatrick/CommonResources.git
pushd $HOME/Developer/CommonResources
./setup-config.sh
@thepatrick
thepatrick / simple-redis-cli.py
Last active March 9, 2018 05:32
Just want to run INFO against a redis server? Don't have redis-cli installed? Think installing it will take longer than writing a python script to run the same command? Don't care if INFO is longer than ~1018 characters? Then this is the python for you!
#!/usr/bin/python
# Thanks to https://gist.github.com/glynnbird/89ad23c2f5e218d067f0de76150598e0 for gen_redis_proto()
import sys
import socket
def gen_redis_proto(cmd):
# break the command by spaces to get the number of tokens
tokens = cmd.split(" ")
@thepatrick
thepatrick / simple-redis-cli.py
Created March 9, 2018 05:14
Just want to run INFO against a redis server? Don't have redis-cli installed? Think installing it will take longer than writing a python script to run the same command? Don't care if INFO is longer than ~1018 characters? Then this is the python for you!
#!/usr/bin/python
import sys
import socket
def gen_redis_proto(cmd):
# break the command by spaces to get the number of tokens
tokens = cmd.split(" ")
proto = "*" + str(len(tokens)) + "\r\n"
for token in tokens:
@thepatrick
thepatrick / out.js
Last active February 20, 2017 03:11
(function(FuseBox){FuseBox.$fuse$=FuseBox;
FuseBox.pkg("default", {}, function(___scope___){
___scope___.file("index.js", function(exports, require, module, __filename, __dirname){
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process.
const electron = require('electron');
@thepatrick
thepatrick / demo.js
Created August 4, 2016 01:27
/usr/bin added to path
console.log(process.env.PATH);