Skip to content

Instantly share code, notes, and snippets.

@alexjs
alexjs / cors-nginx.conf
Created November 28, 2012 22:42 — forked from michiel/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1477726821000",
"Effect": "Allow",
"Action": [
"ec2:AttachVolume",
"ec2:CreateVolume",
"ec2:DescribeVolumes"
#!/bin/bash
############
# Config options here.
# Please also remember to set an IAM role on the instance in question
# Sample policy for that role: https://gist.github.com/5bb67c1e6bfe7aedc691a722a57055f2
############
mountPoint="/opt/myAppName/var/run"
devicePoint="xvdz" # We start from the top down rather than bottom up to avoid conflicts
RewriteEngine On
RewriteCond %{HTTP:X-PSK-Auth} !^e6e59c8c1dcca46fde36bf43b84487d8$
RewriteRule .* - [F]
<?php
# Set a no-cache header header
header('Cache-Control: max-age=0');
echo "REMOTE_ADDR: ". $_SERVER['REMOTE_ADDR'] . "<br>";
$output .= "REMOTE_ADDR: ". $_SERVER['REMOTE_ADDR']."\n";
foreach (getallheaders() as $name => $value) {
echo "$name: $value<br>";
$output .="$name: $value\n";
}
?>
@alexjs
alexjs / .zsh-ssh-hack
Created April 3, 2013 18:06
zsh function to allow ssh'ing direct to a directory
ssh() {
# If we specify host:dir, ssh straight to that dir
if [[ $1 =~ "(.*):(.*)" ]]; then
host=${match[-2]}
path=${match[-1]}
/usr/bin/ssh -t $host "cd ${path} && exec ${SHELL}"
else
/usr/bin/ssh $*
fi
}
@alexjs
alexjs / ideal ops.md
Created May 27, 2012 21:08 — forked from bhenerey/ideal ops.md
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan

Keybase proof

I hereby claim:

  • I am alexjs on github.
  • I am alexjs (https://keybase.io/alexjs) on keybase.
  • I have a public key whose fingerprint is 2C10 A549 3194 0748 E94B 2F63 9F68 2FA8 D2AC 17FE

To claim this, I am signing this object: