Skip to content

Instantly share code, notes, and snippets.

View fincham's full-sized avatar

Michael Fincham fincham

View GitHub Profile
#!/bin/bash
# update the apache ACLs for cloudfront IPs
new=$(while read -r i; do printf "Require ip %s\\n" "$i"; done < <(curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | jq -r '.prefixes[] | select(.service=="CLOUDFRONT") | .ip_prefix'))
if [ "$(sha256sum - <<< "$new" | sed -e 's/ .*//')" != "$(sha256sum /etc/apache2/require-cloudfront-ip.conf | sed -e 's/ .*//')" ]; then
> /etc/apache2/require-cloudfront-ip.conf
while read -r line; do
if [[ "$line" =~ ^Require\ ip\ [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/[0-9]{1,2}$ ]]; then
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/* iris case drawings extracted from https://github.com/keebio/iris-case/blob/master/iris-middle-layer.ai */
module big_bit()
polygon(
points=
[[-22.994, 69.899], [-23.172, 69.887], [-35.425, 68.14], [-48.485, 65.728], [-62.39, 62.645], [-77.177, 58.885], [-78.362, 58.566], [-79.547, 58.247], [-80.508, 57.808], [-81.258, 57.102], [-81.745, 56.195], [-81.918, 55.154], [-81.918, 11.647], [-81.918, -31.861], [-81.667, -33.107], [-80.98, -34.125], [-79.962, -34.811], [-78.715, -35.063], [-46.701, -35.063], [-14.687, -35.063], [-13.44, -35.315], [-12.423, -36.001], [-11.737, -37.019], [-11.485, -38.265], [-11.485, -45.008], [-11.485, -51.75], [-11.28, -52.88], [-10.711, -53.838], [-9.849, -54.544], [-8.764, -54.917], [-7.402, -55.124], [-6.04, -55.331], [-0.743, -56.045], [4.513, -56.648], [14.599, -57.894], [25.088, -59.913], [30.557, -61.448], [36.215, -63.459], [42.09, -66.041], [48.212, -69.287], [49.599, -70.087], [50.987, -70.888], [51.763, -71.209], [52.588, -71.317], [53.005, -71.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env bash
while true; do
echo "ss23 rly, completely, sux"
sleep 1
done
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fincham
fincham / postlogin.py
Created April 12, 2018 03:55
Dovecot post-login location change alerting
#!/usr/bin/python
"""
Store an IMAP user's last location in a file. If it changes, alert the admin. To be run as a Dovecot postlogin script.
Michael Fincham <michael@hotplate.co.nz>
"""
import os
@fincham
fincham / i3-bar.py
Created October 12, 2017 07:56 — forked from jbg/i3-bar.py
#!/usr/bin/python3
from collections import OrderedDict
from datetime import datetime
from functools import partial
import json
import logging as log
import os
from queue import Queue, Empty
import subprocess
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.