Skip to content

Instantly share code, notes, and snippets.

View main.go
package main
import (
"fmt"
"math/rand"
"net/http"
"os"
"time"
vegeta "github.com/tsenart/vegeta/lib"
@leosunmo
leosunmo / intensify.sh
Last active Sep 9, 2021 — forked from alisdair/intensify.sh
intensifies Slack emoji creator
View intensify.sh
#!/bin/bash
# Generate a `:something-intensifies:` Slack emoji, given a reasonable image
# input. I recommend grabbing an emoji from https://emojipedia.org/
set -euo pipefail
if ! command -v identify &> /dev/null
then
if [ "$(uname)" == "Darwin" ]; then
@leosunmo
leosunmo / go.mod
Last active Aug 19, 2020
Simple K8s client to query API resources
View go.mod
module simple-k8s-client
go 1.15
require (
github.com/golang/protobuf v1.4.2 // indirect
github.com/imdario/mergo v0.3.11 // indirect
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de // indirect
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
View docker-compose.yml
version: "3.8"
services:
front-envoy:
build:
context: .
dockerfile: envoy.Dockerfile
args:
ENVOY_NAME: front-envoy
volumes:
@leosunmo
leosunmo / main.go
Last active Jun 10, 2020
Golang workers/channels example
View main.go
package main
import (
"fmt"
"math/rand"
"os"
"os/signal"
"time"
)
@leosunmo
leosunmo / kubectl_auth_function.sh
Created Feb 14, 2018
Kubernetes kubectl bash function using heptio-authenticator-aws + aws-vault to authenticate
View kubectl_auth_function.sh
# aws-vault function
function av() {
if [[ $# -ge 2 ]]; then
case $1 in
ap-admin)
aws-vault exec --session-ttl=4h ap-admin -- ${@:2}
;;
us-admin)
@leosunmo
leosunmo / reassign-partition.sh
Last active Sep 7, 2018
kafka reassign topic script
View reassign-partition.sh
#!/bin/bash
# This hacky script will read the migration JSON file you provide as argument 1 and execute the reassignemnt up to the partition you specify as argument 2.
# This is useful if you don't want to migrate all paritions at once but not have to re-create the reassignment plan everytime
# and keep the reassignments consistent across the whole topic.
# Will work with any properly formatted kafka parition reassignment JSON file.
# Recommended to use with https://github.com/SiftScience/kafka-assigner to give you more control over the reassignemnt.
# will migrate up to the partition you specify
# Example:
@leosunmo
leosunmo / kubectl_function.sh
Last active Mar 16, 2017
Example of bashrc/zshrc kubectl function for multi-namespace/multi-region
View kubectl_function.sh
# one function per cluster/region
function kus() {
case $1 in
# set namespace based on first arg
red)
kubectl --context=kube-prod-us --namespace=red ${@:2}
;;
green)
kubectl --context=kube-prod-us --namespace=green ${@:2}