Skip to content

Instantly share code, notes, and snippets.

View leosunmo's full-sized avatar

Leo Palmer Sunmo leosunmo

  • Boozt
  • Malmö
  • 04:30 (UTC +02:00)
View GitHub Profile
@leosunmo
leosunmo / intensify.sh
Last active January 9, 2023 09:47 — forked from alisdair/intensify.sh
intensifies Slack emoji creator
#!/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
package main
import (
"fmt"
"math/rand"
"net/http"
"os"
"time"
vegeta "github.com/tsenart/vegeta/lib"
@leosunmo
leosunmo / go.mod
Last active August 19, 2020 23:01
Simple K8s client to query API resources
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
version: "3.8"
services:
front-envoy:
build:
context: .
dockerfile: envoy.Dockerfile
args:
ENVOY_NAME: front-envoy
volumes:
@leosunmo
leosunmo / main.go
Last active June 10, 2020 00:28
Golang workers/channels example
package main
import (
"fmt"
"math/rand"
"os"
"os/signal"
"time"
)
@leosunmo
leosunmo / reassign-partition.sh
Last active September 7, 2018 02:19
kafka reassign topic script
#!/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_auth_function.sh
Created February 14, 2018 01:51
Kubernetes kubectl bash function using heptio-authenticator-aws + aws-vault to authenticate
# 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 / kubectl_function.sh
Last active March 16, 2017 02:03
Example of bashrc/zshrc kubectl function for multi-namespace/multi-region
# 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}