Skip to content

Instantly share code, notes, and snippets.

View metral's full-sized avatar
☁️

Mike Metral metral

☁️
View GitHub Profile
@mjdietzx
mjdietzx / waya-dl-setup.sh
Last active March 13, 2024 15:08
Install CUDA Toolkit v8.0 and cuDNN v6.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v8.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network))
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb"
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get -y install cuda
#!/bin/bash
jq -r .Resources.LaunchConfigurationWorker.Properties.UserData assets/cloud-formation.json | base64 -d > launchConfigAssets.txt
jq -r .Resources.InstanceController.Properties.UserData assets/cloud-formation.json | base64 -d > controllerAssets.txt
jq -r '.systemd.units[] | select(.name=="kubelet.service") | .contents' launchConfigAssets.txt > workerKubelet.txt
jq -r '.systemd.units[] | select(.name=="kubelet.service") | .contents' controllerAssets.txt > controllerKubelet.txt
workerExecPreNum=$(grep -m 1 -n 'ExecStartPre' workerKubelet.txt | cut -f1 -d:)
workerMountNum=$(grep -m 1 -n '\-\-volume' workerKubelet.txt | cut -f1 -d:)
sed -i "${workerExecPreNum}iExecStartPre=/bin/mkdir -p /opt/cni/bin" workerKubelet.txt

Ingress configuration options per platform.

Platform Host Port Node Port Cluster IP Provider
Bare-Metal Y Y Y NA
Google Cloud Y N N GLBC
AWS Y Y N NA
DigitalOcean Y Y N NA
Azure Y Y N NA
@ericlagergren
ericlagergren / index.gohtml
Last active December 22, 2023 17:51
Hot-reloading / hot-swapping live template files in Go
My name is {{.Name}} and I'm {{.Age}} years old!!

Single Node Kubernetes Cluster

sudo docker run -d --net=host --privileged --name=kubestack \
-v /sys:/sys:ro \
-v /:/rootfs:ro \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/run:/var/run:rw \
-v /var/lib/kubelet/:/var/lib/kubelet:rw \
-v /var/lib/docker/:/var/lib/docker:ro \

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@alobato
alobato / start-stop-example.sh
Created March 3, 2012 23:09
start-stop-example
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
# Must be a valid filename
NAME=foo
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/local/bin/bar
@bemasher
bemasher / stack.go
Last active August 19, 2020 10:59
A simple LIFO stack backed by a linked list implemented with golang.
package main
import (
"fmt"
)
type Stack struct {
top *Element
size int
}