Skip to content

Instantly share code, notes, and snippets.

View rrichards's full-sized avatar
💭
Rocking the CLI

Ryan Richards rrichards

💭
Rocking the CLI
  • R3 Technologies, Inc.
  • Oklahoma City, OK
  • X @rrichards
View GitHub Profile
docker-rmi() {
docker images \
| fzf --header-lines=1 --multi \
| awk '{print $3}' \
| xargs docker rmi ${1+"$@"}
}
kube-context() {
if [[ -n "$1" ]]; then
context=$1
else
context=$(kubectl config get-contexts \
| fzf --header-lines=1 --no-multi \
| awk '{if ($1!="*") print $1; else print $2 }')
fi
[[ -n ${context} ]] && kubectl config use-context ${context}
#!/usr/bin/env bash
while getopts ":u:" opt; do
case "$opt" in
u)
username="${OPTARG}"
;;
\?)
echo "Invalid option: -${OPTARG}" >&2
return 1
@rrichards
rrichards / sizes.rb
Created April 16, 2019 18:18 — forked from ttscoff/sizes.rb
sizes: Calculate and sort all filesizes for current folder
#!/usr/bin/env ruby
# Sizes - Calculate and sort all filesizes for current folder
# Includes directory sizes, colorized output
# Brett Terpstra 2019 WTF License
VERSION = "1.0.0"
require 'shellwords'
# Just including term-ansicolor by @flori and avoiding all the
# rigamarole of requiring multiple files when it's not a gem... - Brett
@rrichards
rrichards / ReadMe.md
Created April 4, 2019 18:26 — forked from startupsandcode/ReadMe.md
Kubernetes on GKE with Nginx

Kubernetes Configuration

I have included a .env, ingress-nginx.yaml, controller-nginx.yaml, and bash script that will build your cluster and deploys everything in your folder you specifify in the parameter for the bash script parameters

To deploy from your cloud-config/staging folder and create the cluster do this:

./deploy.sh staging y

If you want to upgrade your existing app deployment, simply remove the y

$ sudo nano /etc/systemd/system/startup.service
[Unit]
Description=Startup
[Service]
ExecStart=/usr/local/bin/startup.sh
[Install]
WantedBy=default.target
@rrichards
rrichards / kubernetes_commands.md
Created November 13, 2018 19:35 — forked from edsiper/kubernetes_commands.md
Kubernetes Useful Commands
@rrichards
rrichards / docker_desc.sh
Created July 19, 2018 17:47 — forked from mlinhard/docker_desc.sh
Shell script to find docker image descendants
#!/bin/bash
parent_short_id=$1
parent_id=`docker inspect --format '{{.Id}}' $1`
get_kids() {
local parent_id=$1
docker inspect --format='ID {{.Id}} PAR {{.Parent}}' $(docker images -a -q) | grep "PAR ${parent_id}" | sed -E "s/ID ([^ ]*) PAR ([^ ]*)/\1/g"
}
print_kids() {
@rrichards
rrichards / docker_descendants.py
Created July 19, 2018 17:44 — forked from altaurog/docker_descendants.py
Python3 script to find descendants of one or more docker images
#!/usr/bin/python3
#
# usage: python3 docker_descendants.py <image_id> ...
import sys
from subprocess import check_output
def main(images):
image_ids = set(images)
######################
# Create The Cluster #
######################
# Open Docker Preferences, select the Kubernetes tab, and select the "Enable Kubernetes" checkbox
# Open Docker Preferences, select the Advanced tab, set CPUs to 2, and Memory to 2.0
# Make sure that your current kubectl context is pointing to your Docker for Mac/Windows cluster