Skip to content

Instantly share code, notes, and snippets.

View igilham's full-sized avatar

Ian Gilham igilham

View GitHub Profile
@igilham
igilham / relink-java-binaries.sh
Created November 10, 2014 11:27
Relink Java binaries
@igilham
igilham / CMakeLists.txt
Created December 9, 2014 12:42
CMake add_sources Macro
set(SRCS "")
macro (add_sources)
foreach (_src ${ARGN})
if (_relPath)
list (APPEND SRCS "${_src}")
else()
list (APPEND SRCS "${_src}")
endif()
endforeach()
@igilham
igilham / opencaster-pauser.py
Created January 16, 2015 13:23
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.
#!/usr/local/bin/env python
import signal
import sys
packet_size = 188
position = 0
paused = False
def pause_handler(signal, frame):
@igilham
igilham / yiq-color-balance.py
Last active November 14, 2019 11:32
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.
#!/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 / git-migrate.sh
Created February 27, 2015 17:06
Migrate a file with history from one Git repo to another
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 / .profile
Last active September 28, 2015 14:52
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 / 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

{
"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 / 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
@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