This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: hello-world-pod-2 | |
labels: # You'll use labels A LOT w/ kube | |
app: hello-world # They are useful for organizing and identifying attributes of an object | |
spec: | |
containers: # This spec has multiple containers, how fancy! | |
- name: hello-world-sh | |
image: busybox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: batch/v1 | |
kind: Job | |
metadata: | |
name: pi | |
spec: | |
template: | |
metadata: | |
name: pi | |
spec: | |
containers: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule K8s.Client do | |
@moduledoc """ | |
This is a very naive k8s client. | |
""" | |
alias K8s.Conf.RequestOptions | |
require Logger | |
def post(body, conf) do | |
path = body_to_path(body, false) | |
url = Path.join(conf.url, path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: "3" | |
networks: | |
local-dev: | |
driver: bridge | |
--- | |
version: "3" | |
services: | |
shell: | |
image: busybox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# This uses the silver searcher (ag) | |
TMP_FILE=$(mktemp) | |
# find :ok tuples w/ no error match | |
ag "^\s{0,}\{:ok.*\s=" --ignore 'test' -G '.ex$' . > ${TMP_FILE} | |
# find :ok left side matches w/ no error handling | |
ag "^\s{0,}:ok.*=" --ignore 'test' -G '.ex$' . >> ${TMP_FILE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\set common_pct 0.1 | |
\set common_slow 10 | |
\set other_slow 100 | |
CREATE MATERIALIZED VIEW v_pg_stat_statements AS | |
WITH totals AS ( | |
SELECT sum(calls) as ttl_calls, sum(total_time) as ttl_time | |
FROM pg_stat_statements | |
) | |
SELECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# annoy emoji-name your message here | |
annoy() { | |
emoji=$1 | |
msg="${@:2}" | |
figlet -f banner $msg | sed -e"s/#/:$emoji:/g" | sed -e's/ /:blank:/g' | pbcopy | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################### Configuration ################### | |
TF_NAMESPACE := $(shell basename -s .git `git config --get remote.origin.url`) | |
TF_S3_BUCKET := my-tf-bucket-name | |
TF_VERSION := 0.10.6 | |
################### Constants ################### | |
tmpl-for = $(foreach x,$2,$(call $1,$x)) | |
rule-for = $(foreach x,$2,$(eval $(call $1,$x))) | |
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==> ./module <== | |
==> ./module/main.tf <== | |
variable "msg" {} | |
resource "null_resource" "goodbye" { | |
provisioner "local-exec" { | |
command = "echo ${var.msg}" | |
} | |
} | |
==> ./main.tf <== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "action_dispatch" | |
require "json" | |
# RIP your CPU if you have a lot of traffic. Check out the parallel gem w/ multiple processes to speed this up. | |
list_of_url_paths_visited = File.readlines("list_of_url_paths_visited.txt", chomp: true) | |
# YMMV | |
# the 2nd or 3rd column will be the path w/ awk | |
rake_routes_paths = `rake routes | awk '{if ($2 ~ /\\//) {print $2} else if ($3 ~ /\\//) {print $3}}'`.split("\n") | |