Skip to content

Instantly share code, notes, and snippets.

View cluster.tf
resource "google_container_cluster" "_" {
name = var.cluster_name
location = local.location
min_master_version = var.k8s_version
# To deploy private clusters, uncomment the section below,
# and uncomment the block in network.tf.
# Private clusters require extra resources (Cloud NAT,
# router, network, subnet) and the quota for some of these
# resources is fairly low on GCP; so if you want to deploy
View kind-with-port-80.yaml
# Use this file with "kind create cluster --config kind-with-port-80.yaml"
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
#image: kindest/node:v1.22.2
image: kindest/node:v1.20.7
extraPortMappings:
- containerPort: 30080
hostPort: 80
View command.txt
tanzu standalone-cluster create foo -i docker -v9 --log-file /tmp/log.txt
View gist:0d39b6a92e927e4ff3fa5dfc549e91af
I1109 16:26:32.744639 1109786 loader.go:372] Config loaded from file: /home/jp/.kube/config
I1109 16:26:32.744975 1109786 round_trippers.go:435] curl -k -v -XGET -H "Accept: application/json, */*" -H "User-Agent: kubectl-access_matrix/v0.0.0 (linux/amd64) kubernetes/$Format" 'https://127.0.0.1:35891/api?timeout=32s'
I1109 16:26:32.749813 1109786 round_trippers.go:454] GET https://127.0.0.1:35891/api?timeout=32s 200 OK in 4 milliseconds
I1109 16:26:32.749826 1109786 round_trippers.go:460] Response Headers:
I1109 16:26:32.749829 1109786 round_trippers.go:463] X-Kubernetes-Pf-Prioritylevel-Uid: 202f2898-6a65-45f8-81e8-d05351ca532a
I1109 16:26:32.749832 1109786 round_trippers.go:463] Content-Length: 133
I1109 16:26:32.749837 1109786 round_trippers.go:463] Date: Tue, 09 Nov 2021 15:26:32 GMT
I1109 16:26:32.749839 1109786 round_trippers.go:463] Cache-Control: no-cache, private
I1109 16:26:32.749840 1109786 round_trippers.go:463] Content-Type: application/json
I1109 16:26:32.749842 1109786 roun
View gist:a04e6a75b2dfd78eafafb6e48afc5f07
$ kubectl create secret generic this-one-is-ok --from-literal=sesame=42
secret/this-one-is-ok created
$ kubectl create secret generic this-one-is-not --from-literal=sesame=123
secret/this-one-is-not created
$ kubectl create clusterrole only-ok --verb=get --resource=secret --resource-name=this-one-is-ok
clusterrole.rbac.authorization.k8s.io/only-ok created
$ kubectl create clusterrolebinding only-ok --clusterrole=only-ok --serviceaccount=default:default
clusterrolebinding.rbac.authorization.k8s.io/only-ok created
$ kubectl run podshell --rm -ti --attach --image=nixery.dev/shell/kubectl bash
If you don't see a command prompt, try pressing enter.
@jpetazzo
jpetazzo / README.md
Last active Jul 6, 2021
Science Fiction written by women
View README.md

Ann Leckie, "Ancillary Justice" (+2 sequels)

The AI of a powerful warship gets deprived from its thousands of eyes and hands, and still doesn't know which pronouns to use when interacting with others.

Ursula K. Le Guin, "The Dispossessed"

You can bannish communism to the dark side of the moon, but it will always come back when you least expect it.

Ursula K. Le Guin, "The Left Hand of Darkness"

@jpetazzo
jpetazzo / 🐋.py
Created Apr 18, 2021
Shut up, Moby, you're drunk
View 🐋.py
#!/usr/bin/env python
import random
import unicodedata
partial_states = {
'o': 'Oóòôõ°ø',
'O': 'oÓÒÔÕ0ØΩ',
'ó': 'Óoòôø',
'ò': 'Òoóôø',
View show-output.sh
#!/bin/sh
echo "codec args duration time_real time_user time_sys cpu_percent size_input size_output"
for F in *.log; do
. ./$F
echo "$CODEC $ARGS $duration $TIME_REAL $TIME_USER $TIME_SYS $CPU_PERCENT $SIZE_INPUT $SIZE_OUTPUT"
done
View kind-123.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: ClusterConfiguration
apiServer:
extraArgs:
service-node-port-range: "12301-12309"
@jpetazzo
jpetazzo / fixedfocus.sh
Created Sep 14, 2020
Force focus on webcams (because autofocus is 💩 sometimes)
View fixedfocus.sh
#!/bin/sh
setcam() {
FOCUS=$1
echo "Configuring camera $NAME on /dev/$DEV."
echo "Setting fixed focus to $FOCUS."
v4l2-ctl --device /dev/$DEV -c focus_auto=0
v4l2-ctl --device /dev/$DEV -c focus_absolute=$FOCUS
echo "Setting power line frequency to 50Hz."
v4l2-ctl --device /dev/$DEV -c power_line_frequency=1