Skip to content

Instantly share code, notes, and snippets.

@mwinters0
mwinters0 / 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'
@mwinters0
mwinters0 / 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

@mwinters0
mwinters0 / 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.

@mwinters0
mwinters0 / 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
@mwinters0
mwinters0 / 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
@mwinters0
mwinters0 / wgubs.md
Last active November 23, 2024 21:56
WGU B.S. CompSci 2024 - overview / prep