Skip to content

Instantly share code, notes, and snippets.

View rosstimson's full-sized avatar

Ross Timson rosstimson

View GitHub Profile
@rosstimson
rosstimson / Dockerfile
Created October 13, 2015 20:37
Easily get ffmpeg on Fedora with support for all the things.
# Dockerfile for ffmpeg with pretty much support for everything as per:
# https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
# includes codecs with weird licensing like MP3 and AAC.
#
FROM fedora
MAINTAINER Ross Timson <ross@rosstimson.com>
# Install build requirements.
RUN dnf install -y autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
@rosstimson
rosstimson / pf.conf
Last active August 14, 2022 12:31
Basic FreeBSD PF firewall for web server - /etc/pf.conf
# vim: set ft=pf
# /etc/pf.conf
ext_if="vtnet0"
webports = "{http, https}"
int_tcp_services = "{domain, ntp, smtp, www, https, ftp}"
int_udp_services = "{domain, ntp}"
set skip on lo
@rosstimson
rosstimson / local.remap-tilde.plist
Last active March 20, 2021 15:42
Remap tilde key to top left on a UK MacBook rather than bottom left. Place in: ~/Library/LaunchAgents/local.remap-tilde.plist and run: launchctl load ~/Library/LaunchAgents/local.remap-tilde.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.remap-tilde</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
@rosstimson
rosstimson / libreswan_setup.sh
Created October 2, 2014 21:52
Libreswan VPN setup script.
#!/bin/bash -ex
# Set some local variables
PRIVATE_IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
PUBLIC_IP=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
VPN_DNSHOST=`grep -o "nameserver.*" /etc/resolv.conf | awk '{print $2}'`
yum install -y libreswan ppp xl2tpd
# Setup IPSEC Tunnel
@rosstimson
rosstimson / gist:ad2b79a78159bd80ffeb
Created July 3, 2015 09:01
EC2 tag version of Bash installed.
#!/usr/bin/env bash
EC2_INSTANCE_ID="`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id`"
EC2_REGION="`wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/.$//g'`"
if ! type "aws" > /dev/null; then
if ! type "pip" > /dev/null; then
easy_install pip
fi
pip install awscli
@rosstimson
rosstimson / aws-access-key-to-iam-name.sh
Created June 30, 2014 07:41
Pass this script an AWS access key ID and it will show you what IAM user has that key.
#!/bin/bash -e
#
# Pass this script an AWS access key ID and it will show you what IAM user
# has that key.
#
# Usage:
# aws-access-key-to-iam-name some_key_id
#
readonly PROGNAME=$(basename $0)
@rosstimson
rosstimson / cheese.yml
Last active July 26, 2019 09:11
Kubernetes Traefik and External DNS
# Deployments
# --------------------------------------------------------------------
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: stilton
namespace: dev
labels:
@rosstimson
rosstimson / flatpak.sh
Created June 7, 2019 18:35
/etc/profile.d/flatpak.sh
if command -v flatpak > /dev/null; then
# set XDG_DATA_DIRS to include Flatpak installations
new_dirs=$(
(
unset G_MESSAGES_DEBUG
echo "${XDG_DATA_HOME:-"$HOME/.local/share"}/flatpak"
flatpak --installations
) | (
new_dirs=
@rosstimson
rosstimson / .pre-commit-config.yaml
Last active June 18, 2018 09:38
pre-commit config for Terraform projects.
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict
- id: check-merge-conflict
- id: detect-aws-credentials
- id: detect-private-key
@rosstimson
rosstimson / codeship-ami-builder.py
Created December 1, 2017 16:19
Scheduled Lambda that uses the Codeship API in order to trigger a build.
import boto3
import http.client
import json
import logging
import os
from base64 import b64decode
conn = http.client.HTTPSConnection("api.codeship.com")
payload = "{}"