Skip to content

Instantly share code, notes, and snippets.

@micahhausler
micahhausler / jq-filter.sh
Last active September 21, 2023 07:27
GitHub collaborator finder
# Go to https://developer.github.com/v4/explorer/ and enter the graphql query with the query veriable:
# {"queryString": "your-githubuser-name"}
cat results.json |
jq '.data.user.repositories.edges[] | { Count: .node.collaborators.totalCount, Repo: .node.name} | select(.Count > 2)'
@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 / 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 / bashrc
Created October 10, 2016 13:25
Kubernetes PS1
NORMAL="\[\033[00m\]"
BLUE="\[\033[01;34m\]"
RED="\[\e[1;31m\]"
YELLOW="\[\e[1;33m\]"
GREEN="\[\e[1;32m\]"
PS1_WORKDIR="\w"
PS1_HOSTNAME="\h"
PS1_USER="\u"
__kube_ps1()
@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 / stdout
Created May 19, 2016 19:50
sbt assembly error
[error] Class java.time.Duration not found - continuing with a stub.
[error] Class java.time.Duration not found - continuing with a stub.
[error] missing or invalid dependency detected while loading class file 'DefaultWrites.class'.
[error] Could not access type Instant in value java.time,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'DefaultWrites.class' was compiled against an incompatible version of java.time.
[error] missing or invalid dependency detected while loading class file 'DefaultWrites.class'.
[error] Could not access type LocalDate in value java.time,
[error] because it (or its dependencies) are missing. Check your build definition for
@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 \
@micahhausler
micahhausler / marathon-lb.json
Last active May 6, 2016 20:17
marathon-lb.json
{
"id": "/marathon-lb",
"cmd": null,
"cpus": 1,
"mem": 256,
"disk": 0,
"instances": 2,
"constraints": [
[
"hostname",