Skip to content

Instantly share code, notes, and snippets.

View kylev's full-sized avatar
💭
Pushing the (mostly) right buttons.

Kyle VanderBeek kylev

💭
Pushing the (mostly) right buttons.
View GitHub Profile
@kylev
kylev / aws-op-list.rb
Last active March 17, 2021 02:51
A script to print all the operations in each AWS service endpoint. Useful for crafting well-formed IAM permissions.
#!/usr/bin/env ruby
# List all the (known) operations on each AWS service API. This is
# incredibly useful for building well-restricted IAM access
# rules. With this list you can quickly see what "s3:Get*" matches, or
# just glance through and look for something that might be missing and
# breaking your app.
# I can't believe I had to write this myself. I'm pretty sure there
# are a lot of people out there with near-god-mode permission on IAM
@kylev
kylev / bson2json.rb
Last active November 25, 2016 04:45
Using an eigenclass to make some instances of BSON::ObjectId to serialize to JSON as strings.
require 'json'
require 'bson'
a = BSON::ObjectId.new
b = BSON::ObjectId.new
puts a.to_json
# {"$oid":"5837b91f775ab9717f8d8bc9"}
puts b.to_json
# {"$oid":"5837b92c775ab9717f8d8bca"}
@kylev
kylev / maryhad.clj
Last active December 7, 2017 02:46
"Mary Had a Little Lamb" in Clojure
(ns tutorial.maryhad
"Implementation of \"Mary Had a Little Lamb\"
Found here:
http://www.pianolessons4children.com/sheetmusic/Mary_Had_a_Little_Lamb_C_Major.pdf"
(:require [leipzig.live :as live]
[leipzig.melody :refer :all]
[leipzig.scale :as scale]
[overtone.inst.piano :refer [piano]]
[overtone.live :refer :all]))
@kylev
kylev / Dockerfile
Last active September 21, 2022 00:43
A complete Alpine docker-compose Rails workflow with PostgreSQL and Redis
FROM ruby:2.6-alpine
# Additional runtime facilities provided by the OS.
RUN apk add --no-cache libxml2 libxslt postgresql-libs tzdata
# Tell bundler how to use the OS.
RUN gem install bundler -v '~> 1.17' && \
bundle config build.nokogiri --use-system-libraries
WORKDIR /opt/app
RUN mkdir -p tmp/pids tmp/cache