Skip to content

Instantly share code, notes, and snippets.

View irbekrm's full-sized avatar

Irbe Krumina irbekrm

View GitHub Profile
#!/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
#!/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' \
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
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()
// 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
@irbekrm
irbekrm / slice_args.go
Created April 10, 2020 17:24
Explore how arguments are passed to Go functions by copy (slice)
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
}
@irbekrm
irbekrm / struct_args.go
Last active April 10, 2020 17:25
Explore how arguments are passed to Go functions by copy (struct)
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
}
@irbekrm
irbekrm / struct_args.go
Created April 10, 2020 17:16
Explore how arguments are passed to Go functions by copy
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")
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 \
@irbekrm
irbekrm / stuff
Last active August 18, 2019 15:23
concourse-learning test
Sun Aug 18 15:23:48 UTC 2019