Skip to content

Instantly share code, notes, and snippets.

View matschaffer's full-sized avatar
🧡

Mat Schaffer matschaffer

🧡
View GitHub Profile
# happy comment
resource "foo" "bar" {
}
// red angry comment
resource "foo" "bar" {
}
@matschaffer
matschaffer / Makefile
Last active October 29, 2016 04:48
terraform makefile base
include ../../../common/Makefile.base
data "aws_vpc" "common" {
filter {
name = "tag:Name"
values = ["common"]
}
}
data "aws_subnet" "common" {
count = "${var.availability_zone_count}"
vpc_id = "${data.aws_vpc.common.id}"
@matschaffer
matschaffer / haproxy.log
Created May 16, 2016 02:57
haproxy log & mtail script with buckets
2016-05-10T08:13:03+00:00 localhost haproxy[21]: 192.168.99.1:52177 [10/May/2016:08:12:58.762] http-in webapp-http/webapp 0/0/0/5003/5003 200 185 - - ---- 1/1/1/1/0 0/0 "GET / HTTP/1.1"
2016-05-10T08:13:03+00:00 localhost haproxy[21]: 192.168.99.1:52178 [10/May/2016:08:12:58.916] http-in webapp-http/webapp 0/0/0/5002/5002 200 185 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"
2016-05-10T08:49:25+00:00 localhost haproxy[21]: 192.168.99.1:53129 [10/May/2016:08:49:20.815] http-in webapp-http/webapp 161/0/1/5006/5168 200 185 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"
2016-05-10T08:49:32+00:00 localhost haproxy[21]: 192.168.99.1:53131 [10/May/2016:08:49:27.270] http-in webapp-http/webapp 163/0/0/5005/5168 200 185 - - ---- 0/0/0/0/0 0/0 "GET / HTTP/1.1"
2016-05-16T00:30:59+00:00 localhost haproxy[20]: Proxy http-in started.
2016-05-16T00:32:42+00:00 localhost haproxy[20]: Proxy http-in started.
2016-05-16T00:32:56+00:00 localhost haproxy[21]: 192.168.99.1:52781 [16/May/2016:00:32:51.524] http-in webapp-http/webapp 175/0/1/50
$tt <= 1 {
haproxy_frontend_total_time_milliseconds_bucket[$frontend_name][".001"]++
}
$tt <= 2 {
haproxy_frontend_total_time_milliseconds_bucket[$frontend_name][".002"]++
}
$tt <= 3 {
haproxy_frontend_total_time_milliseconds_bucket[$frontend_name][".003"]++
}
$tt <= 5 {
@matschaffer
matschaffer / bastion.config
Last active February 12, 2016 05:13
ebextensions config to make an app into a viable bastion host - handy if you have an "admin" app aside from your main app
option_settings:
aws:elb:loadbalancer:
SecurityGroups:
- (ID of externally created security group with controlled SSH inbound access)
ManagedSecurityGroup: (same SG as above)
aws:elb:listener:22:
ListenerProtocol: TCP
InstanceProtocol: TCP
InstancePort: 22
aws:elb:policies:
/.vagrant
[alias]
outdated = "!f() { bash -c 'diff -u <(git branch --no-merged master) <(git branch --contains master) | egrep \"^- \"'; }; f"
update = "!f() { set -e; git checkout $1; git rebase master; git push -f origin $1; git checkout -; }; f"
require 'chef/knife'
module Chef
module Knife
class DiffEnvironment < Chef::Knife
banner 'knife diff environment ENVIRONMENT_FILE'
deps do
require 'chef/environment'
@matschaffer
matschaffer / Dockerfile
Last active September 16, 2016 18:07
curl_with_ssh
FROM ubuntu:14.04
ENV CURL_VERSION 7.35.0
ADD prepare.sh /
RUN /prepare.sh
ADD ssh-support.patch /
ADD build.sh /
RUN /build.sh