Skip to content

Instantly share code, notes, and snippets.

View moosh3's full-sized avatar
๐Ÿ
doing devop things

Alec Cunningham moosh3

๐Ÿ
doing devop things
View GitHub Profile
**Project Approach**
* Always check for a PRD (Product Requirements Document) before starting a new task and follow it closely
* Look for comprehensive project documentation to understand requirements before making changes
* Focus only on code areas relevant to the assigned task
* Prefer iterating on existing code rather than creating new solutions
* Keep solutions simple and avoid introducing unnecessary complexity
**Code Quality**
@stackdumper
stackdumper / app.yaml
Created July 18, 2019 15:34
vault-to-env - Kubernetes
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: vte-example
labels:
app: vte-example
spec:
replicas: 1
selector:
matchLabels:
@zepptron
zepptron / gist:9635568b9d90d858daca7780feb8c4b7
Created June 19, 2018 08:34
.bashrc & .zshrc: usefull kubectl + fzf
podlog () {
local pod=($(kubectl get pods --all-namespaces -o wide | fzf | awk '{print $1, $2}'))
echo kubectl logs -n ${pod[1]} ${pod[2]}
kubectl logs -n ${pod[1]} ${pod[2]}
}
podexec () {
local pod=($(kubectl get pods --all-namespaces -o wide | fzf | awk '{print $1, $2}'))
local cmd=${@:-"/bin/sh"}
@alediaferia
alediaferia / countries.go
Created January 3, 2018 19:50
An array of country names in Go
var Countries = []string{
"Afghanistan",
"Albania",
"Algeria",
"American Samoa",
"Andorra",
"Angola",
"Anguilla",
"Antarctica",
"Antigua and Barbuda",
@pteich
pteich / main.go
Last active May 30, 2024 02:57
Example for using go's sync.errgroup together with signal detection signal.NotifyContext to stop all running goroutines
package main
import (
"context"
"errors"
"fmt"
"os/signal"
"syscall"
"time"
@innovia
innovia / kubernetes_add_service_account_kubeconfig.sh
Last active January 29, 2024 23:00
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: ghost
labels:
role: blog
spec:
replicas: 1
template:
metadata:
@ahawkins
ahawkins / await-release
Last active February 8, 2018 03:06
Run 7 log analysis and script
#!/usr/bin/env bash
# This script is a workaround for https://github.com/kubernetes/helm/issues/2288.
# helm install --wait should do everything this script does. It should be deleted
# when the bug is fixed.
set -euo pipefail
main() {
local counter=0 release timeout pods
@ahawkins
ahawkins / test-release
Created May 4, 2017 05:16
Updated script/test-release for helm test run #5
#!/usr/bin/env bash
set -euo pipefail
main() {
local release="${1:-}" test_output pod
test_output="$(mktemp)"
if [ -z "${release}" ]; then
echo "USAGE: ${0} RELEASE" 1>&2
@thehesiod
thehesiod / async_worker_pool.py
Last active September 26, 2024 03:14
Asynchronous Worker Pool, allows for limiting number of concurrent tasks
import asyncio
from datetime import datetime, timezone
import os
def utc_now():
# utcnow returns a naive datetime, so we have to set the timezone manually <sigh>
return datetime.utcnow().replace(tzinfo=timezone.utc)
class Terminator:
pass