Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#hack the planet
morse=".... .- -.-. -.- / - .... . / .--. .-.. .- -. . -"
# testing morse
#morse=".... .... .... --- ..."
# TIME_UNIT
TU=0.1
#!/bin/bash
# Script to watch for dbus events and turn off keylight when monitor screen dims
# Adapted from: https://askubuntu.com/questions/858236/how-do-i-call-dbus-code-that-monitors-when-screen-is-locked-unlocked
# TODO set it up to store previous state when it turns off and restore that state after
# Apache2
# there are a lot of utils out there to control these things, so at least attempt to be portable
export KEYLIGHT_CMD_ON="keylightctl switch -light 7F8C -brightness 3 -temperature 200 on"
export KEYLIGHT_CMD_OFF="/home/nibz/local/bin/keylightctl switch -light 7F8C off"
@nibalizer
nibalizer / Tag_IBM_Cloud_.sh
Created March 14, 2020 17:19
Script fragments for manual tagging resources in IBM Cloud
#!/bin/bash
#source ../local.env
# apache2.0 license
#ibmcloud target -g $RESOURCE_GROUP_NAME
#IAM_TOKEN=$(ibmcloud iam oauth-tokens | grep IAM | awk '{print $4}')
#CLUSTER_CRN=$(ibmcloud ks cluster get --cluster $CLUSTER_NAME_PREFIX$i --json | jq -r .crn)
#CLUSTER_CRN=$CRN
curl \
function get_random(arr){ return arr[Math.floor(Math.random()*arr.length)];}
setInterval(function(){
var elements = document.getElementsByClassName("developer--card__block_link");
get_random(elements).scrollIntoView({ behavior: 'smooth', block: 'center' });
}, 2500);
@nibalizer
nibalizer / ko-ibmcloud
Created June 29, 2019 21:16
script (from andreaf) to auth to ibm cloud registry using ko
ibmcloud login
ibmcloud cr login
REGISTRY_ENDPOINT=$(ibmcloud cr info | awk '/Registry/{ print $3 }' | head -1)
# Create a CR token with write access
CR_TOKEN=$(ibmcloud cr token-add --readwrite --description ko_rw --non-expiring -q)
# Backup your docker config if you have one
cp ~/.docker/config.json ~/.docker/config.json.$(date +%F)
# Setup docker auth so it may talk to the CR.
echo '{"auths":{"'$REGISTRY_ENDPOINT'":{"auth":"'$(echo -n token:$CR_TOKEN | base64 -w0)'"}}}' | jq '.' > ~/.docker/config.json
containerd/io.containerd.runtime.v1.linux/k8s.io/046e80497cccd28cd4768cd7aba56c91eebb7bf17b22dd2a2806e35199f28a72/log.json --log-format json state 046e80497cccd28cd4768cd7aba56c91eebb7bf17b22dd2a2806e35199f28a72 parent=containerd-shim k8s.ns=<NA> k8s.pod=<NA> container=host) k8s.ns=<NA> k8s.pod=<NA> container=host","priority":"Notice","rule":"Change thread namespace","time":"2019-05-25T05:09:45.455656160Z", "output_fields": {"container.id":"host","evt.time":1558760985455656160,"k8s.ns.name":null,"k8s.pod.name":null,"proc.cmdline":"runc --root /run/containerd/runc/k8s.io --log /run/containerd/io.containerd.runtime.v1.linux/k8s.io/046e80497cccd28cd4768cd7aba56c91eebb7bf17b22dd2a2806e35199f28a72/log.json --log-format json state 046e80497cccd28cd4768cd7aba56c91eebb7bf17b22dd2a2806e35199f28a72","proc.pname":"containerd-shim","user.name":"root"}}
{"output":"05:09:45.584579186: Notice Namespace change (setns) by unexpected program (user=root command=runc --root /run/containerd/runc/k8s.io --log /run/containerd/io.co
{"level":"info","ts":"2018-12-07T17:44:27.362Z","caller":"logging/config.go:84","msg":"Successfully created the logger.","knative.dev/jsonconfig":"{\n \"level\": \"info\",\n \"development\": false,\n \"outputPaths\": [\"stdout\"],\n \"errorOutputPaths\": [\"stderr\"],\n \"encoding\": \"json\",\n \"encoderConfig\": {\n \"timeKey\": \"ts\",\n \"levelKey\": \"level\",\n \"nameKey\": \"logger\",\n \"callerKey\": \"caller\",\n \"messageKey\": \"msg\",\n \"stacktraceKey\": \"stacktrace\",\n \"lineEnding\": \"\",\n \"levelEncoder\": \"\",\n \"timeEncoder\": \"iso8601\",\n \"durationEncoder\": \"\",\n \"callerEncoder\": \"\"\n }\n}\n"}
{"level":"info","ts":"2018-12-07T17:44:27.362Z","caller":"logging/config.go:85","msg":"Logging level set to info"}
E1207 17:44:27.367715 1 memcache.go:138] couldn't get current server API group list; will keep using cached value. (Get https://172.21.0.1:443/api?timeout=32s: dial tcp 172.21.0.1:443: connect: connection refused)
E1207 17:44:2
@nibalizer
nibalizer / knative.txt
Created December 7, 2018 19:37
knative scale-to-zero bug?
$ kubectl get -n knative-serving cm/config-autoscaler -o yaml
apiVersion: v1
data:
container-concurrency-target-default: "100"
container-concurrency-target-percentage: "1.0"
enable-scale-to-zero: "true"
enable-vertical-pod-autoscaling: "false"
max-scale-up-rate: "10"
panic-window: 6s
scale-to-zero-grace-period: 1m

Istio Release Twitch Stream!!

Thanks for giving me a bit of your time.  We're doing an Istio celebration stream on August 17th.

What is Twitch?

Twitch is a popluar video gaming live streaming platform and recently has seen a lot of coding content showing up. We've been doing live coding and presentations there and it's been fun.

What does this have to do with Istio?

# python test_for_black_bar.py 06da390c-606f-4adf-961d-444968ced5af_5.png debug/aeee37b5-28f6-4be7-af2e-9cafb763072f_3.png $(ls -d -1 debug/* | sort -R | tail -n 1000)
from PIL import Image
import sys
import math
for _file in sys.argv[1:]:
im = Image.open(_file).convert('L')