Skip to content

Instantly share code, notes, and snippets.

View parabuzzle's full-sized avatar

Mike Heijmans parabuzzle

View GitHub Profile
# This docker file sets up the base container for other applications
#
# https://docs.docker.com/reference/builder/
#
# Author:: Michael Heijmans (mailto:parabuzzle@gmail.com)
# Copyright:: Copyright (c) 2016 Michael Heijmans
# License:: MIT
FROM parabuzzle/ruby:2.3.1
# This docker file sets up the base container for other applications
#
# https://docs.docker.com/reference/builder/
#
# Author:: Michael Heijmans (mailto:parabuzzle@gmail.com)
# Copyright:: Copyright (c) 2016 Michael Heijmans
# License:: MIT
FROM parabuzzle/ruby:2.3.1
#!/usr/bin/env bash
# Wraps a command in the warm and cozy shell we want
#
# Author:: Michael Heijmans (mailto:parabuzzle@gmail.com)
# Copyright:: Copyright (c) 2016 Michael Heijmans
# License:: MIT
set -e
echo -e "Establishing the environment for $APP_ENV from $VAULT_ADDR"
@parabuzzle
parabuzzle / vaultenv
Last active September 28, 2016 16:13
#!/usr/bin/env ruby
# Read an environment variable from the local keyserver
#
# Can be used to initialize environment variables.
#
# export PASSWORD=$( vaultenv db/password )
#
# Author:: Michael Heijmans (mailto:parabuzzle@gmail.com)
# Copyright:: Copyright (c) 2016 Michael Heijmans
# License:: MIT
# A simple library for working with Vault
#
# Author:: Michael Heijmans (mailto:parabuzzle@gmail.com)
# Copyright:: Copyright (c) 2016 Michael Heijmans
# License:: MIT
require 'vault'
require 'yaml'
class VaultLoader
@parabuzzle
parabuzzle / Dockerfile
Created April 1, 2016 17:54
debian package build env
FROM ubuntu:12.04
MAINTAINER parabuzzle@gmail.com
VOLUME /compilations
ENV TERM linux
ENV DEBIAN_FRONTEND noninteractive
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update && apt-get dist-upgrade -qq -y
#
# default .gitconfig
#
[alias]
praise = blame
@parabuzzle
parabuzzle / letter_counter.rb
Last active October 20, 2015 16:47
Needed a simple way of telling me how many of each letter I needed to cut on the laser cutter
def letter_count(str)
str.chars.each_with_object({}) do |char, hash|
next if char == " " # skip spaces
hash.store(char, 0) if hash[char].nil?
hash[char] +=1
end
end
letter_count("hello world").each { |char,count| puts [char, count].join(" == ") }
@parabuzzle
parabuzzle / parse_yaml_for_bash.rb
Created September 15, 2015 23:59
I built this... I'm not proud... but yea, it works....
#!/usr/bin/env ruby
#
# Parses a given yaml file and returns prefix_key=value
# Usage: parse_yaml_for_bash <yaml_file> <prefix>
require 'yaml'
unless ARGV[0]
puts "Usage: parse_yaml_for_bash <yaml_file> <optional prefix>"
exit 1
function duse {
_ENV=`docker-machine env $@`
if [ $? -ne 0 ]; then
printf "$_ENV"
return 1
elif [ -z "$1" ]; then
printf "$_ENV"
else
eval $_ENV