Skip to content

Instantly share code, notes, and snippets.

@micahhausler
micahhausler / Dockerfile
Created February 10, 2020 18:40
amazon-eks-pod-identity-webhook-issue-34
FROM php:alpine
RUN apk -U add composer && \
composer require aws/aws-sdk-php
ADD ./script.php /opt/code/script.php
CMD php /opt/code/script.php
@micahhausler
micahhausler / packages.sls
Created September 9, 2013 17:49
Postgres 9.3 packages salt state
#!yaml
#
# Postgres 9.3 packages salt state
#
# Created 9/9/13
#
# author: Micah Hausler, micah.hausler@akimbo.io
postgres-pkgs:
pkg:
@micahhausler
micahhausler / main.go
Last active August 22, 2019 01:37
CloudConfig loop vs global map benchmark
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/endpoints"
"gopkg.in/gcfg.v1"
)
type CloudConfig struct {
@micahhausler
micahhausler / create.sh
Last active April 12, 2019 17:40
kops - kubernetes 1.9
#!/usr/bin/env bash
export CLUSTER_NAME=${CLUSTER_NAME:-example.cluster.k8s.local}
export KUBERNETES_VERSION=${KUBERNETES_VERSION:-https://storage.googleapis.com/kubernetes-release/release/v1.9.0/}
export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-us-west-2}
# Get all available AZs
export AWS_AVAILABILITY_ZONES="$(aws ec2 describe-availability-zones --query 'AvailabilityZones[].ZoneName' --output text | awk -v OFS="," '$1=$1')"
# Create a unique s3 bucket name, or use an existing S3_BUCKET environment variable
@micahhausler
micahhausler / cc.yaml
Created May 15, 2017 19:06
etcd-v3-proxy
coreos:
units:
- name: etcd3-peers.service
command: start
content: |
[Unit]
Description=Write a file with the etcd peers that we should bootstrap to\n",
Requires=docker.socket
After=docker.socket
@micahhausler
micahhausler / decode.py
Created April 5, 2017 13:11
Morse Code Decrypter
# See https://itunes.apple.com/us/app/medium/id828256236?mt=8, version 2.48
morse = {
".-": "A", "-...": "B", "-.-.": "C", "-..": "D", ".": "E", "..-.": "F", "--.": "G", "....": "H",
"..": "I", ".---": "J", "-.-": "K", ".-..": "L", "--": "M", "-.": "N", "---": "O", ".--.": "P",
"--.-": "Q", ".-.": "R", "...": "S", "-": "T", "..-": "U", "...-": "V", ".--": "W", "-..-": "X",
"-.--": "Y", "--..": "Z", "-----": "0", ".----": "1", "..---": "2", "...--": "3", "....-": "4",
".....": "5", "-....": "6", "--...": "7", "---..": "8", "----.": "9", "/": " ", ".-.-.-": ".",
".----.": "'", "--..--": ","}
text = (
'- .... .. ... / ..- .--. -.. .- - . / -- .- .. -. .-.. -.-- / -.-. --- -. - .- .. -. ... /'
@micahhausler
micahhausler / register_task.py
Last active April 4, 2017 19:25
Boto3 ECS register_task_definition
import os
import boto3
def connect_ecs(region=None):
return boto3.client(
'ecs',
aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID'),
aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY'),
region_name=region or os.environ.get('AWS_EC2_REGION', 'us-east-1'),
)
@micahhausler
micahhausler / audit.log
Last active February 23, 2017 20:26
Kube-DNS SELinux
Feb 23 19:23:04 ip-172-31-11-231.us-west-2.compute.internal audit[32554]: AVC avc: denied { open } for pid=32554 comm="dashboard" path="/public/en/index.html" dev="overlay" ino=48298053 scontext=system_u:system_r:svirt_lxc_net_t:s0:c370,c736 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file permissive=1
Feb 23 19:24:56 ip-172-31-11-231.us-west-2.compute.internal audit[10853]: AVC avc: denied { execute } for pid=10853 comm="exechealthz" name="sh" dev="xvdb" ino=2490773 scontext=system_u:system_r:svirt_lxc_net_t:s0:c399,c912 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file permissive=1
Feb 23 19:24:56 ip-172-31-11-231.us-west-2.compute.internal audit[10853]: AVC avc: denied { read open } for pid=10853 comm="exechealthz" path="/bin/sh" dev="overlay" ino=138907031 scontext=system_u:system_r:svirt_lxc_net_t:s0:c399,c912 tcontext=system_u:object_r:unlabeled_t:s0 tclass=file permissive=1
Feb 23 19:24:56 ip-172-31-11-231.us-west-2.compute.internal audit[10853]: AVC avc: denied { execute_no_trans }
@micahhausler
micahhausler / kube-dns.yaml
Last active August 24, 2016 13:44
Prometheus Error scraping skydns
apiVersion: v1
kind: Service
metadata:
name: kube-dns
namespace: kube-system
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "KubeDNS"
annotations:
@micahhausler
micahhausler / build.sh
Created May 19, 2016 19:12
Build Mesos & Marathon with SSL
#!/bin/bash
cat <<EOF > /home/core/Dockerfile
FROM debian:jessie
MAINTAINER Micah Hausler, <hausler.m@gmail.com>
RUN echo "deb http://httpredir.debian.org/debian jessie-backports main" | \
tee -a /etc/apt/sources.list \
&& apt-get -y update \
&& apt-get -y install \