Skip to content

Instantly share code, notes, and snippets.

View elmiko's full-sized avatar

Michael McCune elmiko

View GitHub Profile
@elmiko
elmiko / mdcodestrip.py
Created February 28, 2013 18:11
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.
#!/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()
@elmiko
elmiko / gist:0086b3f59634a2993d6e95988d6b97ed
Last active August 24, 2016 20:15 — forked from pweil-/gist:0cb9f196bde594b96f84
scripts for doing some rebase work with openshift
[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
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 / main.go
Created January 7, 2018 16:46 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@elmiko
elmiko / https.go
Created January 7, 2018 16:51 — 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
package main
import (
"crypto/tls"
"golang.org/x/crypto/acme/autocert"
"log"
"net"
"net/http"
)
@elmiko
elmiko / oshinko-python36-spark-build-dc.yaml
Created May 18, 2018 20:31
oshinko python36 experimental s2i builder template
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 / kubectl-riffs.cheat
Last active April 28, 2020 19:21
kubernetes command line incantations
% 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"}'