Skip to content

Instantly share code, notes, and snippets.

View mdevilliers's full-sized avatar
💭
Crufting

Mark deVilliers mdevilliers

💭
Crufting
View GitHub Profile
@darpr
darpr / argo-in-kind.md
Created September 7, 2020 19:08
"Argo Workflow" in `kind` Cluster

Argo in Kind

Play with "Argo Workflow" in your local kind cluster.

Prerequisites

The following instructions were tested in macOS Catalina (10.15.6), on 6 Sep 2020.

Docker Runtime

Ensure docker is installed and running.

K8s Client

@robhaswell
robhaswell / Dockerfile
Last active July 17, 2025 21:16
mdadm notifications to Slack
FROM ubuntu:20.04
RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install -y mdadm python3-minimal ca-certificates
RUN mkdir /app
WORKDIR /app
ADD notify.py .
@sahilsk
sahilsk / burrow.toml
Last active November 27, 2024 08:07
Burrow configuration with slack and pagerduty notification
[general]
pidfile="burrow.pid"
stdout-logfile="burrow.out"
[logging]
filename="/opt/burrow/logs/burrow.log"
level="info"
maxsize=100
maxbackups=10
maxage=10
@tennix
tennix / dashbord-to-jsonnet.py
Last active June 25, 2025 12:55
Convert Grafana dashboard json to jsonnet
#!/usr/bin/env python
import json
from jinja2 import Template
# git clone https://github.com/pingcap/tidb-docker-compose
# cd tidb-docker-compose
# git clone https://github.com/tennix/grafonnet-lib -b table
# python dashboard-to-jsonnet.py > pd.jsonnet
# jsonnet -J grafonnet-lib pd.jsonnet > config/dashboards/generated-pd.json
with open('config/dashboards/pd.json', 'r') as f:
data = json.load(f)
@Integralist
Integralist / Explain How Vary HTTP header works.md
Last active June 10, 2019 11:57
[How Vary HTTP header works] #fastly #vcl #cdn #vary

Vary Behaviour

To understand HTTP's Vary behaviour we first must understand how the CDN works in the traditional sense of caching and looking up resources.

Note: at the bottom of this page is a sequence diagram which visually illustrates how Vary works (if you prefer a more visual aid).

The CDN caches requests based on a given pair of Host and Path values. So when the CDN accepts a request, as an example, for the resource https://www.buzzfeed.com/videos the CDN will take the Host (e.g. www.buzzfeed.com) and the Path (e.g. /videos) and generate a hash of those values which will become the 'cache key'. Later when the CDN receives the same request from a different client it'll generate the same hash and lookup the resource in its cache using the hash as the key.

Depending on the client, the origin server that generates response content (which will be cached in the CDN) may well want to serve different content for different clients

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

Single Node Kubernetes Cluster

sudo docker run -d --net=host --privileged --name=kubestack \
-v /sys:/sys:ro \
-v /:/rootfs:ro \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/run:/var/run:rw \
-v /var/lib/kubelet/:/var/lib/kubelet:rw \
-v /var/lib/docker/:/var/lib/docker:ro \
@israelshirk
israelshirk / aconnection.py
Last active November 17, 2020 16:36
Boto SES + Python Twisted
# Overrides parts of Boto to provide async call/response. Derived from
# SESConnection and boto/connection.
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2011 Harry Marr http://hmarr.com/
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
@jbardin
jbardin / proxy_copy.go
Last active April 27, 2025 20:47
Go TCP Proxy pattern
package proxy
import (
"io"
"log"
"net"
)
func Proxy(srvConn, cliConn *net.TCPConn) {
// channels to wait on the close event for each connection
@neilellis
neilellis / obtain_subnet_address.sh
Last active August 29, 2015 14:06
Create a subnet for this host to use in zettio/weave
#!/bin/bash -eu
#apt-get install -y jq
host_ip=$1
#Check to see if we have a cached session for this machine and if it is still valid
if [ -f ~/.consul_subnet_session ] && [[ -n $(< ~/.consul_subnet_session) ]] && [[ $(curl "http://localhost:8500/v1/session/info/$(< ~/.consul_subnet_session)") != null ]]
then
session=$(< ~/.consul_subnet_session)
else