Skip to content

Instantly share code, notes, and snippets.

View matschaffer's full-sized avatar
🧡

Mat Schaffer matschaffer

🧡
View GitHub Profile
locations:
vancouver
west chester
santa monica
new babies and reaching #3
hashicorp IPO
consulting with nyc companies
Given /^I expect to pay \$(\d+) via amazon$/ do |arg1|
price = arg1.to_f
mock_pipeline_request = mock('pipeline_request',
:url => sekret_payment_path(:transaction_amount => price))
Remit::API.any_instance.
expects(:get_recurring_use_pipeline).
with{ |opts| opts[:transaction_amount] == price }.
returns(mock_pipeline_request)
@matschaffer
matschaffer / .env
Created October 20, 2021 04:40
docker-compose.yml
env-hyphens=ok
env.dots=ok
@matschaffer
matschaffer / gist:4912279e49dce41ab9b2
Last active July 6, 2021 13:05
Bash-friendly ec2 prices
#!/usr/bin/env bash
URL="http://a0.awsstatic.com/pricing/1/ec2/ri-v2/linux-unix-shared.min.js"
(echo 'function callback(data) { console.log(JSON.stringify(data)); }'; curl -s "$URL") |\
node |\
jq -r '.config.regions[] |
select(.region == "us-east-1") |
.instanceTypes[] |
[
@matschaffer
matschaffer / check-attached-policies.sh
Created March 19, 2021 14:29
Shows all role and user policies - Helpful for deprecation of AWSElasticBeanstalkService
for R in $(aws iam list-roles --query 'Roles[].RoleName[]' --output text); do
echo "$R"
aws iam list-attached-role-policies --role-name "$R"
done
for U in $(aws iam list-users --query 'Users[].UserName[]' --output text); do
echo "$U"
aws iam list-attached-user-policies --user-name "$U"
done
function ESPlayer(server, indexPattern, playCallback, initialLoad = 40, delay = 10, blockDuration = 10, size = 10) {
this.server = server;
this.indexPattern = indexPattern;
this.playCallback = playCallback;
this.initialLoad = initialLoad;
this.delay = delay;
this.blockDuration = blockDuration;
this.size = size;
this.blocks = [];
}
module MaRuKu::Out::Prawn
def to_prawn(pdf)
@pdf = pdf
@pdf.font_size = 11
array_to_prawn(@children)
end
def array_to_prawn(children)
children.each do |c|
send("to_prawn_#{c.node_type}", c)
@matschaffer
matschaffer / mdtopdf.rb
Created September 27, 2010 03:42
A rough translation of markdown to pdf
require 'rubygems'
require 'jekyll'
require 'maruku'
require 'pathname'
# Need pre for inline format support
gem 'prawn', '=0.11.1.pre'
require 'prawn'
require 'to_prawn'
class Converter
require 'gsl'
require 'time'
module Diskalerter
class ThresholdEstimator
attr_reader :timestamps, :signal, :threshold, :now
# timestamps - a list of timestamps in epoch milliseconds
# signal - a list of values for the provided timestamps
# threshold - the "exhaustion" threshold (e.g., 100 for a percentage signal)
actions:
1:
action: reindex
description: Reindex 2017 indices to single index
options:
wait_interval: 9
max_wait: -1
request_body:
source:
index: REINDEX_SELECTION