Skip to content

Instantly share code, notes, and snippets.

View matschaffer's full-sized avatar
🧡

Mat Schaffer matschaffer

🧡
View GitHub Profile
@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
@matschaffer
matschaffer / README.md
Last active October 20, 2022 21:11
New Laptop Install list

Do first

  • Dropbox
  • 1Password

Managed

  • Slack
  • Flycut
  • Zoom
  • Google drive
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 = [];
}
actions:
1:
action: reindex
description: Reindex 2017 indices to single index
options:
wait_interval: 9
max_wait: -1
request_body:
source:
index: REINDEX_SELECTION
@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
@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 / 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
@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
[06/02/17, 15:15:44:796] error: WebView: Renderer crash occurred in webView: {"src":"https://REDACTED.slack.com/messages"}
[06/02/17, 15:15:44:797] info: Store: RELOAD
{ everything: true }