Skip to content

Instantly share code, notes, and snippets.

Ian Gilham igilham

Block or report user

Report or block igilham

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 / fetch-aws-credentials.sh
Last active Jun 17, 2019
Fetch AWS credentials for CLI usage via Wormhole
View fetch-aws-credentials.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

View .profile
#!/bin/bash
# Profile for Mac OS X systems
# Proxy setup ----------------------------------------------------------
export PROXY_HOST=www-proxy.example.com
export PROXY_PORT=80
function proxy_reset() {
if [ "$1" = "MyCompany On Network" ]; then
@igilham
igilham / git-migrate.sh
Created Feb 27, 2015
Migrate a file with history from one Git repo to another
View git-migrate.sh
cd repository
git log --pretty=email --patch-with-stat --reverse --full-index --binary -- path/to/file_or_folder > patch
cd ../another_repository
git am < ../repository/patch
@igilham
igilham / yiq-color-balance.py
Last active Nov 14, 2019
Works out the YIQ values of a given RGB colour and suggests a pallet of similar colours with the same chrominance. This can be used on legacy TV platforms to reduce chroma crawl, where colours bleed into each other.
View yiq-color-balance.py
#!/usr/bin/env python
import sys
def rgb2Yiq(red, green, blue):
y = int((0.299 * red) + (0.587 * green) + (0.114 * blue))
i = int((0.596 * red) - (0.275 * green) - (0.321 * blue))
q = int((0.212 * red) - (0.528 * green) + (0.311 * blue))
return (y, i, q)
@igilham
igilham / opencaster-pauser.py
Created Jan 16, 2015
An untested experimental program to stream files one packet at a time, with a pause feature. This will certainly be very slow if it works at all.
View opencaster-pauser.py
#!/usr/local/bin/env python
import signal
import sys
packet_size = 188
position = 0
paused = False
def pause_handler(signal, frame):
You can’t perform that action at this time.