Skip to content

Instantly share code, notes, and snippets.

View chrisboulton's full-sized avatar

Chris Boulton chrisboulton

View GitHub Profile
@chrisboulton
chrisboulton / ip_blacklist.lua
Last active April 2, 2024 10:43
Redis based IP blacklist for Nginx (LUA)
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@chrisboulton
chrisboulton / viscosity-to-ios-connect.rb
Last active March 21, 2024 00:59
Quickly convert all of your Viscosity connections into OVPN configuration files for OpenVPN for iOS (bundles certificates and keys in the files too)
config_files = Dir.glob("#{ENV['HOME']}/Library/Application Support/Viscosity/OpenVPN/*/config.conf")
config_files.each do |file|
certificate_files = ['ca', 'cert', 'key', 'tls-auth']
config_dir = File.dirname(file)
connection_name = nil
new_config = []
File.read(file).each do |line|
line.strip!
@chrisboulton
chrisboulton / neomatrix-demo.ino
Created August 5, 2015 18:09
neomatrix-demo.ino
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#define PSTR // Make Arduino Due happy
#endif
#define PIN 6
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(1, 294, PIN,
@chrisboulton
chrisboulton / check_sentinel
Created April 27, 2014 03:34
Awful Nagios plugins to monitor a Redis Sentinel environment
#!/usr/bin/env ruby
#
# Nagios plugin to monitor Redis sentinel
#
# Checks general connectivity to a Redis sentinel server and will go critical
# for any of the following conditions:
# * Inability to connect to the sentinel server
# * Sentinel reports it isn't monitoring any masters
# * Sentinel has entered TILT mode
#
admin:
port: 9990
ip: 0.0.0.0
routers:
# http 1.1: service -> [linkerd] -> linkerd -> service
# should lookup consul service then rewrite outgoing port to linkerd
- label: http1-out
protocol: http
servers:

Keybase proof

I hereby claim:

  • I am chrisboulton on github.
  • I am chrisboulton (https://keybase.io/chrisboulton) on keybase.
  • I have a public key whose fingerprint is AFC0 D65B 0400 7402 1D15 3852 3DC3 08EE 762F 7CCF

To claim this, I am signing this object:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMSAx
IDEAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj
dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa
@chrisboulton
chrisboulton / gist:8380227
Created January 12, 2014 03:08
npm-insanity.log
npm http GET https://registry.npmjs.org/uglifycss/0.0.7
npm http GET https://registry.npmjs.org/grunt-rails-asset-digest/0.2.0
npm http GET https://registry.npmjs.org/grunt-contrib-jasmine/0.4.1
npm http GET https://registry.npmjs.org/grunt-coffeelint/0.0.6
npm http GET https://registry.npmjs.org/grunt-contrib-handlebars/0.5.10
npm http GET https://registry.npmjs.org/grunt-contrib-uglify
npm http GET https://registry.npmjs.org/grunt-contrib-copy/0.4.1
npm http GET https://registry.npmjs.org/grunt-contrib-clean/0.4.1
npm http GET https://registry.npmjs.org/grunt-contrib-watch/0.4.1
npm http GET https://registry.npmjs.org/grunt-contrib-sass
http://wac.7AC6.edgecastcdn.net/007AC6/pokemons-2.gif
http://ord1.wac.edgecastcdn.net/007AC6/pokemons-2.gif
http://jfk1.wac.edgecastcdn.net/007AC6/pokemons-2.gif
http://dfw1.wac.edgecastcdn.net/007AC6/pokemons-2.gif
http://atl1.wac.edgecastcdn.net/007AC6/pokemons-2.gif
http://dca1.wac.edgecastcdn.net/007AC6/pokemons-2.gif
http://syd1.wac.edgecastcdn.net/007AC6/pokemons-2.gif
http://lax1.wac.edgecastcdn.net/007AC6/pokemons-2.gif
http://lhr1.wac.edgecastcdn.net/007AC6/pokemons-2.gif
@chrisboulton
chrisboulton / gist:6570939
Last active December 23, 2015 02:59
collects-fpm-build.sh (you probably don't want to use this yet, I'm still testing it)
#!/bin/bash
set -e
apt-get -y install libyajl-dev libxml2-dev libvirt-dev libvarnish-dev \
libupsclient1-dev libtokyotyrant-dev libtokyocabinet-dev libsnmp-dev \
libsensors4-dev librrd-dev librabbitmq-dev libprotobuf-c0-dev libpq-dev \
libperl-dev libpcap-dev libopenipmi-dev liboping-dev libnotify-dev \
libmysqlclient-dev libmodbus-dev libmemcached-dev libesmtp-dev libdbi0-dev \
libcurl4-gnutls-dev javahelper iptables-dev iproute-dev protobuf-c-compiler \
python-dev openjdk-6-jdk liblvm2-dev libmnl-dev
./configure \