Skip to content

Instantly share code, notes, and snippets.

View Sushant's full-sized avatar

Sushant Bhadkamkar Sushant

View GitHub Profile
@Sushant
Sushant / spinnaker-ingress.yml
Created February 28, 2018 00:02
Spinnaker Deck Ingress
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: spinnaker
labels:
app: spinnaker-spinnaker
component: deck
name: spinnaker-deck-ingress
spec:
rules:
@Sushant
Sushant / spinnaker-kubeconfig.yaml
Last active February 27, 2018 00:29
Spinnaker Kube config
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://kubernetes.svc.default
name: spinnaker-local
contexts:
- context:
cluster: spinnaker-local
namespace: spinnaker
user: spinnaker-svc-account
@Sushant
Sushant / ingress-example.yaml
Created January 3, 2018 01:18
Ingress example
apiVersion: v1
kind: ReplicationController
metadata:
name: echoheaders
spec:
replicas: 1
template:
metadata:
labels:
app: echoheaders
@Sushant
Sushant / kubeconfig-oidc-token
Last active December 7, 2017 18:47
Kubeconfig for OIDC
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://127.0.0.1:6443
name: local-secure
- cluster:
insecure-skip-tls-verify: true
server: http://127.0.0.1:8080
name: local-insecure
@Sushant
Sushant / token_kubeconfig
Created December 1, 2017 21:49
Kubeconfig with token
clusters:
- cluster:
insecure-skip-tls-verify: true
server: http://127.0.0.1:8080
name: k8s-sushant
contexts:
- context:
cluster: k8s-sushant
namespace: kube-system
user: admin
apiVersion: v1
kind: Pod
metadata:
name: aws-cli
labels:
name: aws-cli
annotations:
iam.amazonaws.com/role: arn:aws:iam::1234567890:role/test-role-dynamo-ro
spec:
containers:
containers:
....
volumeMounts:
- mountPath: /etc/foo/template
name: foo-template-volume
readOnly: true
- mountPath: /etc/foo/config
name: foo-config-volume
volumes:
- name: foo-template-volume
@Sushant
Sushant / docker-commands.md
Last active January 18, 2016 20:08
Docker commands/tricks

Remove all stopped containers

docker rm $(docker ps -aq)

docker inspect <image> docker diff <image> docker history <image>

docker exec -it <container_name>

You should attach to the container using the --sig-proxy=false option like this:

def union(parent,child):
"""Performs a union by attaching the root node of the smaller set to the
root node of the larger set"""
if parent.set_size < child.set_size:
child, parent = parent, child
parent_head = find(parent)
child_head = find(child)
if parent_head == child_head:
@Sushant
Sushant / gist:89ce5231602a7d5ebd06
Created November 25, 2014 02:41
Memoizing in Python
from functools import wraps
def memo(func):
cache = {}
@wraps(func)
def wrap(*args):
if args not in cache:
cache[args] = func(*args)
return cache[args]
return wrap