Skip to content

Instantly share code, notes, and snippets.

@cbron
cbron / aggregation.sh
Created Jul 23, 2020
Example of User Facing ClusterRole aggregation
View aggregation.sh
##
# 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 Jun 18, 2020 — forked from alena1108/images.sh
images digests generation
View images.sh
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 Oct 11, 2019
Base spec test
View main.go
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 Nov 13, 2019 — forked from daxmc99/k3dStart.sh
k3d local development script
View k3dStart.sh
#!/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 Aug 22, 2019 — forked from trestletech/instance-types.sh
Check a specific EC2 Instance Type in All Availability Zones
View instance-types.sh
#!/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 Oct 14, 2019
URL encode/decode script
View urlencode
#!/usr/bin/python
import urllib
import sys
text = sys.argv[1]
encoded = urllib.quote_plus(text)
print encoded
View 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:

View reddit.py
#!/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: "))