Skip to content

Instantly share code, notes, and snippets.

View igilham's full-sized avatar

Ian Gilham igilham

View GitHub Profile
@igilham
igilham / fzkill
Created July 23, 2021 10:52
Fuzzy Kill script. Use `fzf` to locate a process to kill.
#!/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 November 11, 2020 11:08
Enable/Disable company proxy settings on MacOS
#!/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 October 8, 2020 08:28
Unity Editor ReadOnly Attribute
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class ReadOnlyAttribute : PropertyAttribute
{
}
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
@igilham
igilham / CameraFollow.cs
Last active October 8, 2020 16:11
Really basic Unity camera script to follow the player object.
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 August 28, 2018 09:31
Copy all data (by scanning) from one DynamoDB table to another
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 April 14, 2021 10:57
Fetch AWS credentials for CLI usage via Wormhole
#!/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 February 22, 2018 12:08
Prelude in bash scripts to declare installed command requirements
#!/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 June 22, 2017 09:34
Vagrantfile for basic C++ development
# -*- 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
{
"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 August 25, 2016 10:04
Use OpenSSL to generate RSA key pairs for client and server using a CA

Useing OpenSSL to generate RSA keys for client-server applications

Set up directories

mkdir -p ca client server

Generate a CA