Skip to content

Instantly share code, notes, and snippets.

View WintersMichael's full-sized avatar

Michael Winters WintersMichael

View GitHub Profile
@WintersMichael
WintersMichael / virtualbox.md
Last active December 27, 2022 00:55
Virtualbox notes

1: Creation

Creating a VM with an existing disk image:

export VM_NAME="Neon Dev"

VBoxManage list ostypes | less

VBoxManage createvm --name "${VM_NAME}" --ostype Ubuntu22_LTS_64 --register
@WintersMichael
WintersMichael / mac_python_setup.md
Last active December 21, 2021 19:37
Mac python setup

Mac python

Assumes zsh and homebrew

Pyenv (python versions)

Installing pyenv

brew install python3 pyenv
echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
@WintersMichael
WintersMichael / finditems.py
Last active December 9, 2020 22:45
Python recursive search
# Recursively searches a Python object (composed of both dicts and lists) to find all items with key name `key`
def finditems(obj, key, results: list = None) -> list:
if results is None:
# this is the outermost function call, so init storage for all recursive calls
results = []
if isinstance(obj, dict):
if key in obj:
results.append(obj[key])
# recurse through dict
@WintersMichael
WintersMichael / effective_meetings.md
Created January 22, 2019 22:03
Holding Effective Meetings

Holding Effective Meetings

(Courtesy of bradrox.)

One of the things that interested me most about joining this team was the opportunity to work with a bunch of very competent people. Smart people, working hard can accomplish a tremendous amount more than any process and training can do. Thank you for this opportunity!

Smart people get bored easily. Meetings provide a perfect breeding ground for boredom. Once you’ve said what you need to say, it can be difficult to listen to everyone else who needs to say what they came to say. Smart, bored people have very clever ways of creating distractions that reduce the effectiveness of meetings. However, “effective listening” is one of the most important techniques to master if you want to shorten meetings…and thereby reduce boredom. Here are a few reminders that should improve the effectiveness of your next meeting. You can find many other resources available on the web.

@WintersMichael
WintersMichael / create_kubernetes_cluster_with_kops_and_terraform.md
Last active June 12, 2018 19:48
Create a Kubernetes cluster at AWS with kops and terraform

Create a Kubernetes cluster at AWS with kops and terraform

This is how I do it. Considerations going into this approach are:

  • It puts all of your resources under terraform control, making it easy to reuse terraform code from other projects and/or use terraform for further integrations.
  • It permits a fair amount of flexibility in workstation configuration (no need to hardcode your workstation to match mine).
  • It provides a good setup for locally switching between multiple projects which might not all be running the same versions.

The examples here will assume that you are going to create a dev cluster for a fictional product named "Bigmoney". It is suggested to not use your product name in your cluster names, since product names are at the whim of marketing and other business tides. Instead, we will use a project codename of "ampersand" to signify "my team's clusters".

Workstation setup

@WintersMichael
WintersMichael / patch_configmap.sh
Created February 7, 2018 16:38
Patch / update a configmap from inside Kubernetes using curl
KUBE_TOKEN=$(</var/run/secrets/kubernetes.io/serviceaccount/token)
NAMESPACE=myapp-dev
CONFIGMAP_NAME=testconfig
curl -sSk \
-X PATCH \
-d @- \
-H "Authorization: Bearer $KUBE_TOKEN" \
-H 'Accept: application/json' \
-H'Content-Type: application/strategic-merge-patch+json' \
https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT_443_TCP_PORT/api/v1/namespaces/$NAMESPACE/configmaps/$CONFIGMAP_NAME <<'EOF'
#!/bin/bash
ifconfig | grep -E 'inet |inet addr' | awk '{print $2}' | cut -d ':' -f 2 | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)'

Understanding Kubernetes in 10 minutes

This document provides a rapid-fire overview of Kubernetes concepts, vocabulary, and operations. The target audience is anyone who runs applications in a cloud environment today, and who wants to understand the basic mechanics of a Kubernetes cluster. The goal is that within 10 minutes, managers who read this should be able to listen in on a Kubernetes conversation and follow along at a high level, and engineers should be ready to deploy a sample app to a toy cluster of their own.

This orientation doc was written because the official Kubernetes docs are a great reference, but they present a small cliff to climb for newcomers.

If you want to understand why you should consider running Kubernetes, see the official Kubernetes conceptual overview document. This document is intended to complement that one, but one layer deeper.

For a deep dive, see [Kubernetes concepts](https://kubernetes.io/docs/co

Keybase proof

I hereby claim:

  • I am MikeSchuette on github.
  • I am mikeschuette (https://keybase.io/mikeschuette) on keybase.
  • I have a public key whose fingerprint is 241A C25E 2FD6 A447 2A07 2B2B 0948 DF33 EAD1 37EC

To claim this, I am signing this object:

@WintersMichael
WintersMichael / check_nodes_for_plugin.sh
Created May 25, 2017 21:29
Find which nodes in your elasticsearch cluster are missing the cloud-aws plugin
#!/bin/bash
#Assumes that you already have jq installed
curl 'localhost:9200/_nodes' | jq '.nodes[] | if (.plugins | map(.name == "cloud-aws") | any) == false then {name: .name, ip: .ip} else empty end'