Skip to content

Instantly share code, notes, and snippets.

View mlafeldt's full-sized avatar

Mathias Lafeldt mlafeldt

View GitHub Profile
@mlafeldt
mlafeldt / vault.go
Created December 2, 2015 15:43
Talk to Vault using GitHub auth backend
package main
import (
"log"
"os"
"github.com/hashicorp/vault/api"
"github.com/hashicorp/vault/builtin/credential/github"
)
@mlafeldt
mlafeldt / Rakefile
Last active April 20, 2018 16:06
The Rake tasks I use to manage my blog
require 'stringex'
POSTS_DIR = '_posts'
BUILD_DIR = '_site'
DEPLOY_DIR = '_deploy'
DEPLOY_BRANCH = 'master'
def git(*args)
sh 'git', *args
end
$ docker images quay.io/mlafeldt/chef-runner
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
quay.io/mlafeldt/chef-runner rpm b524faf0fe69 42 hours ago 830.3 MB
quay.io/mlafeldt/chef-runner deb d26c1d8dc51c 42 hours ago 622.9 MB
$ docker push quay.io/mlafeldt/chef-runner
The push refers to a repository [quay.io/mlafeldt/chef-runner] (len: 2)
Sending image list
Pushing repository quay.io/mlafeldt/chef-runner (2 tags)
Image 511136ea3c5a already pushed, skipping
@mlafeldt
mlafeldt / recipe.rb
Created January 9, 2015 10:47
Package Go tools with fpm-cookery (automatically uses godep dependencies if present)
class ChefRunner < FPM::Cookery::Recipe
GOPACKAGE = "github.com/mlafeldt/chef-runner"
name "chef-runner"
version "0.8.0"
revision 1
source "https://#{GOPACKAGE}/archive/v#{version}.tar.gz"
sha256 "a7de23f989f8353ecf838b551a8ceff09b83c8aeff2553b2c31d57615f8fcc53"
description "The fastest way to run Chef cookbooks"
@mlafeldt
mlafeldt / spec-runner.sh
Created November 7, 2014 13:41
Helper script to run individual Puppet RSpec tests, best used with https://github.com/Jimdo/vim-spec-runner
#!/bin/sh
# Helper script to run (almost) any individual Puppet RSpec test.
# Usage: ./scripts/spec-runner <specfile[:line]> ...
set -e
PUPPET_ROOT=$(cd -P -- $(dirname -- "$0")/.. && pwd)
if test "$PUPPET_ROOT" != "$(pwd -P)"; then
echo >&2 "error: spec-runner must be executed in $PUPPET_ROOT"
@mlafeldt
mlafeldt / install.sh
Last active August 29, 2015 14:07
Omnibus installer
#!/bin/sh
# WARNING: REQUIRES /bin/sh
#
# - must run on /bin/sh on solaris 9
# - must run on /bin/sh on AIX 6.x
# - if you think you are a bash wizard, you probably do not understand
# this programming language. do not touch.
# - if you are under 40, get peer review from your elders.
#
# Author:: Tyler Cloke ([email protected])
@mlafeldt
mlafeldt / Rakefile
Created September 22, 2014 20:12
My Jekyll Rake tasks
# Rake tasks for Jekyll
# Inspired by https://github.com/imathis/octopress/blob/master/Rakefile
require 'rake/clean'
require 'redcloth'
require 'stringex'
POSTS_DIR = '_posts'
BUILD_DIR = '_site'
DEPLOY_DIR = '_deploy'
@mlafeldt
mlafeldt / puppet-installer.sh
Created September 15, 2014 17:29
Helper script to install a specific version of Puppet
#!/bin/sh
# Helper script to install a specific version of Puppet
# Usage: puppet-installer.sh <distro name> <Puppet version>
set -e
DISTRO=$1
VERSION=$2
CURRENT=$(apt-cache policy puppet | awk '/Installed:/ {print $2}' 2>/dev/null)
@mlafeldt
mlafeldt / main.go
Created September 4, 2014 19:21
Go YAML
package main
import (
"fmt"
"log"
"gopkg.in/yaml.v1"
)
var data = `
@mlafeldt
mlafeldt / image_processor.py
Created April 10, 2014 12:21
Batch processing script from Architecting on AWS training
import boto
import json
import time
import sys
import getopt
import argparse
import os
import logging
import StringIO
import uuid