Skip to content

Instantly share code, notes, and snippets.

View matschaffer's full-sized avatar
🧡

Mat Schaffer matschaffer

🧡
View GitHub Profile
@matschaffer
matschaffer / get_solution_stack_name.sh
Last active February 7, 2019 03:44
A script for pulling an elasticbeanstalk solution name for a given runtime version
#!/usr/bin/env bash
set -euo pipefail
MINOR_VERSION=$(awk -F. '{print $1 "." $2}' $(dirname $0)/../.ruby-version)
NAME_FILTER="{\"Type\":\"PlatformName\",\"Operator\":\"begins_with\",\"Values\":[\"Puma with Ruby ${MINOR_VERSION}\"]}"
VERSION_FILTER='{"Type":"PlatformVersion","Operator":"=","Values":["latest"]}'
PLATFORM_ARN=$(
aws elasticbeanstalk list-platform-versions \
class Bottles
def word_part(n)
case n
when 0
"no more bottles"
when 1
"1 bottle"
else
"#{n} bottles"
end
[StatsdInput]
address = "localhost:8125"
[StatAccumInput]
type = "StatAccumInput"
ticker_interval = 1
emit_in_fields = true
percent_threshold = 95
[statmetric_atlas_encoder]
@matschaffer
matschaffer / api_demo.py
Created August 7, 2018 13:46
A python example uploading and submitting a safecast drive
import sys
import requests
import os
endpoint = os.environ.get("SAFECAST_API", "https://api.safecast.org")
api_key = os.environ.get("SAFECAST_API_KEY")
if len(sys.argv) != 2:
print("Usage: {} <LOGFILE>".format(sys.argv[0]), file=sys.stderr)
@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
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
yum install -y wget
wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %>http://rbel.co/rbel5
rpm -Uvh rbel5
yum install -y rubygem-chef
'
@matschaffer
matschaffer / Makefile
Created April 13, 2018 01:56
Terraform makefile
SHELL = /bin/bash
terraform_opts ?=
terraform_plan_opts ?=
.PHONY: help
help::
@echo
@echo Infrastructure management using Terraform.
@echo
require 'rubygems'
require 'erubis'
class TemplateRunner
class OutputBuffer < String
alias :append= :<<
alias :safe_concat :<<
end
class Eruby < Erubis::Eruby
@javascript
Scenario: confiming when saving inactive
Given I expect to click "OK" on a confirmation box saying "Are you sure?"
When I press "Save"
Then the confirmation box should have been displayed
And I should see "TV" in the "Campaign Keywords" section
@matschaffer
matschaffer / .gitignore
Last active November 22, 2017 08:10
A demo tree for basic ECE installation on GCP
.terraform
*.tfstate*
terraform.tfvars
bootstrap-secrets.json