Skip to content

Instantly share code, notes, and snippets.

View denniswebb's full-sized avatar

Dennis Webb denniswebb

View GitHub Profile
@denniswebb
denniswebb / swagger-ui.tf
Created October 11, 2016 02:55
Terraform template for deploying Swagger-UI to S3 website.
variable "region" {default = "us-west-2"}
variable "website_dns" {default = "swagger-ui.webblab.info"}
variable "r53_zone_id" {default = "Z1S59LUERGUH56"}
variable "swagger_ui_version" {default = "v2.2.5"}
provider "aws" {
region = "${var.region}"
}
resource "aws_s3_bucket" "main" {
@denniswebb
denniswebb / userdata_i3_8x.sh
Created April 16, 2017 19:04
Userdata for configuring RAID0 on AWS i3.8xlarge
#!/usr/bin/env bash
mkdir -p /data
mdadm --create --verbose --level=0 /dev/md0 --name=DATA --raid-devices=4 /dev/nvme0n1 /dev/nvme1n1 /dev/nvme2n1 /dev/nvme3n1
mdadm --wait /dev/md0
mkfs.ext4 /dev/md0
mdadm --detail --scan >> /etc/mdadm.conf
dracut -H -f /boot/initramfs-$(uname -r).img $(uname -r)
echo /dev/md0 /data ext4 defaults,nofail,noatime,discard 0 2 >> /etc/fstab
mount -a
@denniswebb
denniswebb / keybase.md
Last active August 23, 2018 01:06
keybase.md

Keybase proof

I hereby claim:

  • I am denniswebb on github.
  • I am dhwebb (https://keybase.io/dhwebb) on keybase.
  • I have a public key ASDGWe1yawPF5lcPtJjxamPO7euHSiJiQo2_thZrakxEuQo

To claim this, I am signing this object:

@denniswebb
denniswebb / aws_cli_install.tf
Last active September 1, 2023 16:47
Terraform module to install aws cli for Terraform Enterprise (Atlas)
data "template_file" "main" {
template = <<EOF
set -e
WORKDIR=/tmp/${uuid()}
mkdir -p "$WORKDIR"
cd "$WORKDIR"
curl -f "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -i "$WORKDIR"/aws
data "aws_region" "current" {
current = true
}
module "aws_cli_install" {
source = "../aws_cli_install"
}
data "template_file" "main" {
template = <<EOF
@denniswebb
denniswebb / github.tf
Created October 3, 2017 16:45
Terraform module for creating GitHub repositories.
variable "repository_name" {}
variable "auto_init" {
default = true
}
variable "description" {
default = ""
}
variable "github_token" {}
provider "github" {
organization = "denniswebb"
token = "${var.github_token}"
}
module "datadog-openvpn" {
source = "modules/github"
package main
import "reflect"
func FieldValueByTag(s interface{}, tag, tagValue string) interface{} {
t := reflect.TypeOf(s)
for i := 0; i < t.NumField(); i++ {
if tagValue == t.Field(i).Tag.Get(tag) {
return reflect.ValueOf(s).FieldByName(t.Field(i).Name)
@denniswebb
denniswebb / SplitAfterNSize
Created December 5, 2017 19:31
Golang function to split a string by size on a separator.
func StringSplitAfterNSize(s, sep string, size int) (resp []string) {
rl := ""
for _, line := range strings.SplitAfter(s, sep) {
if len(rl+line) > size {
resp = append(resp, rl)
rl = ""
}
rl += line
}
if len(resp) > 0 && len(rl) == 0 {
@denniswebb
denniswebb / rancher.yaml
Created January 20, 2018 23:12
userdata for single host RancherOS
#cloud-config
hostname: rancher-ergon
rancher:
console: debian
services:
rancher-server:
image: rancher/server
command: --db-host mysql.denniswebb.info
restart: always
ports: