This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
val=$(cat /dev/urandom | tr -dc '[:alpha:]' | fold -w ${1:-63} | head -n 1) | |
for i in {0..100}; do | |
kubectl create service clusterip "test${i}" --tcp 80:80 | |
for j in {0..200}; do | |
kubectl label "service/test${i}" "key${j}"="${val}" | |
done | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu | |
# This script measures time taken to set up 10 self signed CA issuers and issue 50 certs for each | |
# Uncomment to patch cert-manager to add certificate owner refs to secrets for easier resource cleanup | |
# kubectl patch deployment cert-manager \ | |
# -ncert-manager \ | |
# --type='json' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
// Initialize | |
var wg sync.WaitGroup | |
for i := 0; i < 5; i++ { | |
// Add 1 to the counter | |
wg.Add(1) | |
go hello(i, &wg) | |
} | |
// Wait blocks till the value of counter becomes 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
// Initialize | |
var wg sync.WaitGroup | |
for i := 0; i < 5; i++ { | |
// Add 1 to the counter | |
wg.Add(1) | |
go hello(i, &wg) | |
} | |
// Wait blocks till the value of counter becomes 0 | |
wg.Wait() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GKE | |
// Create a GKE cluster with 1 preemptible node and that is enrolled in rapid release channel | |
gcloud beta container clusters create NAME \ | |
--num-nodes=1 \ | |
--preemptible \ | |
--release-channel=rapid | |
// List GKE clusters | |
gcloud beta container clusters list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
s := []int{0} | |
ModifySliceFunc(s) | |
fmt.Printf("s: %v, pointer to s: %p", s, &s) // s: [999], pointer to s: 0x40a0f0 | |
} | |
func ModifySliceFunc(s []int) { | |
s[0] = 999 | |
fmt.Printf("s: %v, pointer to s: %p\n", s, &s) // s: [999], pointer to s: 0x40a0e0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
m := MyStruct{"foo"} | |
ModifyStructFunc(m, "bar") | |
fmt.Printf("m: %+v, pointer to m: %p", m, &m) // m: {X:foo}, pointer to m: 0x40c138 | |
} | |
func ModifyStructFunc(m MyStruct, s string) { | |
m.X = s | |
fmt.Printf("m: %+v, pointer to m: %p", m, &m) // m: {X:bar}, pointer to m: 0x40c140m | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type MyStruct struct { X string } | |
func ModifyStructFunc(m MyStruct, s string) { | |
m.X = s | |
fmt.Printf("m: %+v, pointer to m: %p", m, &m) // m: {X:changed}, pointer to m: 0x40c140m | |
} | |
func main() { | |
m := MyStruct{"x"} | |
ModifyStructFunc(m, "changed") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export BOSH_NON_INTERACTIVE=true | |
// Create Bosh environment | |
bosh create-env ~/workspace/bosh-deployment/bosh.yml \ | |
--state ./state.json \ | |
-o ~/workspace/bosh-deployment/virtualbox/cpi.yml \ | |
-o ~/workspace/bosh-deployment/virtualbox/outbound-network.yml \ | |
-o ~/workspace/bosh-deployment/bosh-lite.yml \ | |
-o ~/workspace/bosh-deployment/bosh-lite-runc.yml \ | |
-o ~/workspace/bosh-deployment/uaa.yml \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sun Aug 18 15:23:48 UTC 2019 |
NewerOlder