Skip to content

Instantly share code, notes, and snippets.

@cbron
cbron / aggregation.sh
Created July 23, 2020 16:37
Example of User Facing ClusterRole aggregation
##
# Example of User Facing ClusterRole aggregation
# https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles
#
# Note: This demo assumes switching back and forth between two terminal windows.
# It is not a bash script to be run in full.
##
# Set cluster api-server address manually
server=TODO
@cbron
cbron / images.sh
Created June 18, 2020 23:06 — forked from alena1108/images.sh
images digests generation
while read in
do
docker pull "$in"
repo=$(echo $in | cut -f1 -d/)
image_tmp=$(echo $in | cut -f2 -d/)
image=$(echo $image_tmp | cut -f1 -d:)
tag=$(echo $image_tmp | cut -f2 -d:)
docker images --digests | grep "$image" | grep "$repo" | grep "$tag" | awk '{print "| " $1 ":" $2 " | " $3 " |"}' | sed 's/| //g' | sed 's/ |//g' >> rancher-images-digests.txt
docker rmi "$in"
done < rancher-images.txt
@cbron
cbron / main.go
Created October 11, 2019 00:39
Base spec test
package integration
import (
"fmt"
"testing"
"github.com/sclevine/spec"
"github.com/sclevine/spec/report"
)
func TestObject(t *testing.T) {
@cbron
cbron / k3dStart.sh
Last active November 13, 2019 15:10 — forked from daxmc99/k3dStart.sh
k3d local development script
#!/bin/bash
#set -x
#set -e
# Run with: k3dStart test
# This will remove and recreate a k3s cluster named test
[[ -z "$1" ]] && { echo "You must specify a cluster name" ; exit 1; }
name=$1
@cbron
cbron / instance-types.sh
Last active August 22, 2019 18:22 — forked from trestletech/instance-types.sh
Check a specific EC2 Instance Type in All Availability Zones
#!/bin/bash
check_instance_type="m5.large"
product_description="Linux/UNIX"
echo > instance-types.csv
echo "Getting list of Availability Zones"
all_regions=$(aws ec2 describe-regions --region us-east-1 --output text --query 'Regions[*].[RegionName]' | sort)
all_az=()
@cbron
cbron / urlencode
Last active October 14, 2019 14:14
URL encode/decode script
#!/usr/bin/python
import urllib
import sys
text = sys.argv[1]
encoded = urllib.quote_plus(text)
print encoded
@cbron
cbron / keybase.md
Created May 11, 2017 17:20
keybase.md

Keybase proof

I hereby claim:

  • I am cbron on github.
  • I am cbron (https://keybase.io/cbron) on keybase.
  • I have a public key whose fingerprint is 4A6E 2D30 0300 DF73 F2DE 564A 6735 A286 404C 0A46

To claim this, I am signing this object:

@cbron
cbron / reddit.py
Last active December 18, 2015 15:49 — forked from cbronazc/gist:5767996
#!/usr/bin/env python
import json
import urllib2
running = True
hdr = { 'User-Agent' : 'Someone is browsing reddit on their console' }
print "`exit` exits"
while running:
sub = str(raw_input("Enter a subreddit: "))