Skip to content

Instantly share code, notes, and snippets.

Avatar

Ian Gilham igilham

View GitHub Profile
@igilham
igilham / fzkill
Created Jul 23, 2021
Fuzzy Kill script. Use `fzf` to locate a process to kill.
View fzkill
#!/bin/sh
# Fuzzy find and kill a process. Supports signal codes (-9 etc.)
set -e
pid="$(ps -ef | fzf | awk '{ print $2}')"
kill $@ ${pid}
@igilham
igilham / proxy.py
Last active Nov 11, 2020
Enable/Disable company proxy settings on MacOS
View proxy.py
#!/usr/bin/env python3
from argparse import ArgumentParser
import os
import subprocess
proxy_host = os.getenv('PROXY_HOST', default='http-gw.mycompany.com')
proxy_port = os.getenv('PROXY_PORT', default='80')
base_java_opts = os.getenv("BASE_JAVA_OPTS", "")
on_network = "MyCompany On Network"
@igilham
igilham / ReadOnlyAttribute.cs
Created Oct 8, 2020
Unity Editor ReadOnly Attribute
View ReadOnlyAttribute.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class ReadOnlyAttribute : PropertyAttribute
{
}
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
@igilham
igilham / CameraFollow.cs
Last active Oct 8, 2020
Really basic Unity camera script to follow the player object.
View CameraFollow.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Simple camera follow system
public class CameraFollow : MonoBehaviour
{
// The target to follow
public Transform Target;
// Position offset from target
@igilham
igilham / dynamodbcp.py
Last active Aug 28, 2018
Copy all data (by scanning) from one DynamoDB table to another
View dynamodbcp.py
from __future__ import print_function
import argparse
import boto3
def copy_table(source, target):
dynamodb = boto3.resource("dynamodb")
source_table = dynamodb.Table(source)
target_table = dynamodb.Table(target)
@igilham
igilham / aws-wormhole-login.sh
Last active Apr 14, 2021
Fetch AWS credentials for CLI usage via Wormhole
View aws-wormhole-login.sh
#!/bin/bash
# reconfigure AWS CLI credentials
set -e
function requires() {
if ! command -v "$1" &>/dev/null; then
echo "Requires $1"
exit 1
fi
@igilham
igilham / requires.sh
Created Feb 22, 2018
Prelude in bash scripts to declare installed command requirements
View requires.sh
#!/bin/bash
# Declare requirements in bash scripts
set -e
function requires() {
if ! command -v $1 &>/dev/null; then
echo "Requires $1"
exit 1
fi
@igilham
igilham / Vagrantfile
Last active Jun 22, 2017
Vagrantfile for basic C++ development
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Requires the vagrant-vbguest plugin
# vagrant plugin install vagrant-vbguest
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
# sets up the parent directory as the synced folder, so you can place the Vagrantfile in a sub-dir in your workspace
View aws-cloudformation-gamin-rig.json
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "AWS CloudFormation deploys a Windows machine used for Steam",
"Parameters": {
"AWSAMI": {
"Description": "Choose the AMI ID for your Steam machine. This should be a Windows Server 2012 R2 instance and the ID will look like ami-XXXXXXXX",
"Type": "AWS::EC2::Image::Id"
},
"AWSSubnet": {
"Description": "Choose a subnet for the Steam instance.",
@igilham
igilham / keygen.md
Last active Aug 25, 2016
Use OpenSSL to generate RSA key pairs for client and server using a CA
View keygen.md

Useing OpenSSL to generate RSA keys for client-server applications

Set up directories

mkdir -p ca client server

Generate a CA