Skip to content

Instantly share code, notes, and snippets.

View kgriffs's full-sized avatar

Kurt Griffiths kgriffs

View GitHub Profile
@kgriffs
kgriffs / naxsi.rules
Created March 17, 2020 15:12 — forked from goblindegook/naxsi.rules
WordPress (Nginx)
# -*- mode: nginx; mode:autopair; mode: flyspell-prog; ispell-local-dictionary: "american" -*-
# LearningMode;
SecRulesEnabled;
DeniedUrl "/RequestDenied"
CheckRule "$SQL >= 8" BLOCK;
CheckRule "$RFI >= 8" BLOCK;
CheckRule "$TRAVERSAL >= 4" BLOCK;
@kgriffs
kgriffs / unused.py
Created January 20, 2020 22:47 — forked from jmvrbanac/unused.py
Get Unused Port
def get_unused_port():
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('localhost', 0))
_, port = sock.getsockname()
sock.close()
return port
@kgriffs
kgriffs / gcp_ips.sh
Last active October 15, 2019 17:17 — forked from vulkoingim/gcp_ips.sh
Get GCP Public IP Ranges
#!/usr/bin/env bash
# This script lists all ip ranges currently used by
# the google cloud platform, according to ns-lookup / dig
# TXT _cloud-netblocks.googleusercontent.com
#
# https://cloud.google.com/compute/docs/faq#find_ip_range
errcho() {
>&2 echo "$@"
@kgriffs
kgriffs / compile-haproxy.sh
Created May 25, 2018 23:16 — forked from meanevo/compile-haproxy.sh
Compile HAProxy from source on CentOS 7
# Make sure you have these installed
yum install -y make gcc perl pcre-devel zlib-devel
# Download/Extract source
wget -O /tmp/haproxy.tgz http://www.haproxy.org/download/1.7/src/haproxy-1.7.2.tar.gz
tar -zxvf /tmp/haproxy.tgz -C /tmp
cd /tmp/haproxy-*
# Compile HAProxy
# https://github.com/haproxy/haproxy/blob/master/README
make \
TARGET=linux2628 USE_LINUX_TPROXY=1 USE_ZLIB=1 USE_REGPARM=1 USE_PCRE=1 USE_PCRE_JIT=1 \
@kgriffs
kgriffs / aws.md
Created April 28, 2018 19:50 — forked from colinvh/aws.md
AWS Region Names

Alternative naming schemes for AWS regions

Purpose

The intent is to define terse, standards-supported names for AWS regions.

Schemes

@kgriffs
kgriffs / GPG and git on macOS.md
Created August 29, 2017 22:13 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@kgriffs
kgriffs / gunicorn_options.yml
Created May 10, 2017 23:46 — forked from jmvrbanac/gunicorn_options.yml
Capture Client Certificate CN from Gunicorn
bind: 0.0.0.0:8000
workers: 1
worker_class: "example.worker:CustomWorker"
timeout: 30
ca_certs: ca.crt
certfile: server.crt
keyfile: server.key
cert_reqs: 2
do_handshake_on_connect: true
@kgriffs
kgriffs / __main__.py
Created September 14, 2016 15:52 — forked from jmvrbanac/__main__.py
Example Custom Gunicorn Application
"""
Sample Application
Usage:
sample [options]
Options:
-h --help Show this screen.
"""
import aumbry
@kgriffs
kgriffs / falcon_perf.rst
Created September 12, 2016 16:31 — forked from jmvrbanac/falcon_perf.rst
Performance numbers for Falcon with different servers

Setup

  1. apt-get update
  2. apt-get upgrade -y
  3. apt-get install -y apt-transport-https ca-certificates
  4. apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
  5. echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" > /etc/apt/sources.list.d/docker.list
  6. apt-get update
  7. apt-get install -y docker-engine
@kgriffs
kgriffs / pr.md
Created July 1, 2016 16:56 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: