Skip to content

Instantly share code, notes, and snippets.

@mikemadisonweb
mikemadisonweb / kubectl-cs.md
Created January 15, 2018 13:08 — forked from luebken/kubectl-cs.md
Kubectl Cheatsheet
# start up a cluster
KUBERNETES_PROVIDER=vagrant ./cluster/kube-up.sh

# start a simple vagrant cluster
NUM_NODES=1 KUBERNETES_PROVIDER=vagrant KUBE_ENABLE_CLUSTER_MONITORING=none KUBE_ENABLE_CLUSTER_UI=false ./cluster/kube-up.sh

# validate cluster 
./cluster/validate-cluster.sh
kubectl cluster-info
@mikemadisonweb
mikemadisonweb / gist:6ac971ad9a136501628a1cb32368f43e
Last active January 10, 2018 12:59 — forked from jessedearing/gist:2351836
Create self-signed SSL certificate for Nginx
#!/usr/bin/env bash
usage () {
echo -e "Usage:\nself-signed-cert-gen.sh DOMAIN";
}
# Parse command line options
DOMAIN=""
while [ $# -gt 0 ]
do
case "$1" in
@mikemadisonweb
mikemadisonweb / .Title
Created August 29, 2017 11:47 — forked from congjf/.Title
Using MongoDB in golang with mgo
Using MongoDB in golang with mgo
@mikemadisonweb
mikemadisonweb / grace.go
Created August 25, 2017 06:42 — forked from rcrowley/grace.go
Graceful stop in Go
package main
import (
"log"
"net"
"os"
"os/signal"
"sync"
"syscall"
"time"
@mikemadisonweb
mikemadisonweb / testUnderstandRaceCondition.go
Created August 18, 2017 07:13 — forked from crosalot/testUnderstandRaceCondition.go
Understand Race Condition with Go
package main
import (
"fmt"
"time"
"sync/atomic"
)
var start time.Time
@mikemadisonweb
mikemadisonweb / requests.go
Created August 17, 2017 07:22 — forked from huttotw/requests.go
Concurrent requests, with max retries and error handling
package main
import (
"errors"
"fmt"
"math/rand"
"sync"
"time"
)
@mikemadisonweb
mikemadisonweb / abort.go
Created August 16, 2017 14:55
Run a http.Get async with support for aborting
package main
import (
"errors"
"fmt"
"net"
"net/http"
"sync"
"time"
)
@mikemadisonweb
mikemadisonweb / concurrency.go
Created August 16, 2017 14:27 — forked from sethmcl/concurrency.go
Simple example of goroutines and channels
package main
import (
"fmt"
"net/http"
)
const maxConcurrentRequests = 100
type Response struct {
@mikemadisonweb
mikemadisonweb / latency.txt
Created July 20, 2017 09:14 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@mikemadisonweb
mikemadisonweb / exceptions-tree.php
Created June 19, 2017 13:41 — forked from mlocati/exceptions-tree.php
Throwable and Exceptions tree
<?php
if (!function_exists('interface_exists')) {
die('PHP version too old');
}
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
printTree($throwablesPerParent);
if (count($throwablesPerParent) !== 0) {
die('ERROR!!!');