Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael McCune elmiko

View GitHub Profile
@elmiko
elmiko / kubectl-riffs.cheat
Last active Apr 28, 2020
kubernetes command line incantations
View kubectl-riffs.cheat
% kubectl
# get all pods in cluster and show what node they are deployed on
kubectl get pods -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.spec.nodeName}{"\n"}' --all-namespaces
# get all pods on a node and show what namespace they are in
kubectl get pods -o=jsonpath='{range .items[?(@.spec.nodeName=="<Node ID>")]}{.metadata.name}{"\t"}{.metadata.namespace}{"\n"}' --all-namespaces
# get all machines and show their associated node
kubectl get machines -o=jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.status.nodeRef.name}{"\n"}'
@elmiko
elmiko / oshinko-python36-spark-build-dc.yaml
Created May 18, 2018
oshinko python36 experimental s2i builder template
View oshinko-python36-spark-build-dc.yaml
apiVersion: v1
kind: Template
labels:
application: oshinko-python-spark
createdBy: template-oshinko-python36-spark-build-dc
metadata:
annotations:
description: Create a buildconfig, imagestream and deploymentconfig using source-to-image and Python Spark source files hosted in git
openshift.io/display-name: Apache Spark Python
name: oshinko-python36-spark-build-dc
@elmiko
elmiko / https.go
Created Jan 7, 2018 — forked from kennwhite/https.go
Simple https http/2 static web server with HSTS & CSP (A+ SSLLabs & securityheaders.io rating) in Go using LetsEncrypt acme autocert
View https.go
package main
import (
"crypto/tls"
"golang.org/x/crypto/acme/autocert"
"log"
"net"
"net/http"
)
@elmiko
elmiko / main.go
Created Jan 7, 2018 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
View main.go
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
View gist:0d11d4170a734bf6a70053fd2c0a14b2
git clone https://github.com/torch/tutorials.git
docker run -it -p 8888:8888 -p 6006:6006 -v tutorials:/root/sharedfolder floydhub/dl-docker:cpu jupyter notebook
@elmiko
elmiko / gist:0086b3f59634a2993d6e95988d6b97ed
Last active Aug 24, 2016 — forked from pweil-/gist:0cb9f196bde594b96f84
scripts for doing some rebase work with openshift
View gist:0086b3f59634a2993d6e95988d6b97ed
[pweil@localhost codebase]$ ./restore.sh
+ export GOPATH=/home/pweil/codebase/rebase
+ GOPATH=/home/pweil/codebase/rebase
+ rm -rf /home/pweil/codebase/rebase
+ mkdir -p /home/pweil/codebase/rebase
+ cd /home/pweil/codebase/rebase
+ go get github.com/kubernetes/kubernetes
package github.com/kubernetes/kubernetes
imports github.com/kubernetes/kubernetes
imports github.com/kubernetes/kubernetes: no buildable Go source files in /home/pweil/codebase/rebase/src/github.com/kubernetes/kubernetes
@elmiko
elmiko / mdcodestrip.py
Created Feb 28, 2013
I liked the ideas put forward by the 1.5.0 version of CoffeeScript for using Markdown documents as both source file and documentation. Here is a quick and dirty Python file to do the same type of preprocessing for any language.
View mdcodestrip.py
#!/usr/bin/env python
import argparse
import markdown
import os.path
from bs4 import BeautifulSoup
def read_code_from_file(mdfile):
"""returns a string of the code sections in the Markdown file"""
origfilepos = mdfile.tell()