Skip to content

Instantly share code, notes, and snippets.

View shrikeh's full-sized avatar

Barney Hanlon shrikeh

View GitHub Profile
@shrikeh
shrikeh / csrf-lua.conf
Created February 6, 2013 13:15
A simple nginx host file that, using the lua module, handles CSRF, rather than the backend having to (and thus generally breaking caching by having to use Set-Cookie). Here, the front end takes care of CSRF, and sends an X-CSRF-Valid header to the backend regarding the validity of the POST, so that it is advisory (the backend then choose whether…
server {
listen 80;
root /root/to/your/docroot;
proxy_redirect off;
proxy_intercept_errors on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@shrikeh
shrikeh / nginx-handrolled-lua-spdy-pagespeed
Last active January 17, 2019 16:50
Set up nginx with Lua, Pagespeed, et al.
# Ubuntu instructions
# Get the pre-reqs for this (Ubuntu)
sudo apt-get install git-core build-essential zlib1g-dev libpcre3 libpcre3-dev redis-server libssl-dev libgeoip-dev libgoogle-perftools-dev geoip-database lua5.1 liblua5.1-0 liblua5.1-0-dev lua-iconv-dev libghc-iconv-dev luarocks libpcre3-dev libghc-zlib-bindings-dev
# For Centos:
sudo yum install wget
wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
@shrikeh
shrikeh / Vagrantfile.example
Last active June 5, 2017 12:03
CentOS 6 Python bootstrap, necessary for Packer and Vagrant if you wish to provision with Python-based provisioners such as Ansible
# Add this to your Provisioning somewhere.
$bootstrap_script = 'https://gist.githubusercontent.com/shrikeh/7773030d8b237ea3b7c5baab2652d927/raw/centos6-python-bootstrap.sh'
# CentOS 6.8 doesn't come with Python 2.7, so we need to tweak this
config.vm.provision 'bootstrap',
type: 'shell',
path: $bootstrap_script
FROM php:7.0.10-cli
COPY ./demo /demo
CMD 'echo Application demo container'
@shrikeh
shrikeh / keybase.md
Last active September 14, 2016 12:43

Keybase proof

I hereby claim:

  • I am shrikeh on github.
  • I am shrikeh (https://keybase.io/shrikeh) on keybase.
  • I have a public key whose fingerprint is 04D6 A374 5B14 B775 5937 BF40 FAE3 8D23 DC0F 6A4A

To claim this, I am signing this object:

- name: Setup a new instance
hosts: webservers
connection: local
user: root
gather_facts: false
tasks:
- name: Ensure the ssh key for root is setup
digital_ocean: >
state=present
command=ssh
@shrikeh
shrikeh / brew.yml
Created September 1, 2014 12:35
Test ansible mainfiest for brew
---
brew_manifest:
- openssl
- ant
- curl
- wget
- bash
- zsh
- heroku-toolbelt
- zsh-completions
<?php
class Foo extends \FilterIterator
{
public function accept()
{
return true;
}
}
<?php
namespace TabletopWargaming\ValueObject\Army\ArmyList;
use \FilterIterator;
use \Iterator;
use \TabletopWargaming\ValueObject\Army\ArmyList;
class ListIterator extends FilterIterator
{