Skip to content

Instantly share code, notes, and snippets.

Working from home

Mohan Balasundaram tuxfight3r

Working from home
View GitHub Profile
tuxfight3r / gist:b67e94e5a09c61c0c31b00ec0a6e8eb5
Created Jul 14, 2021
python decode kubernetes service token (JWT Token)
View gist:b67e94e5a09c61c0c31b00ec0a6e8eb5
# retrieve the default kubernetes service account token
kubectl get secret $(kubectl get serviceaccounts default -o jsonpath='{.secrets[0].name}') -o json|jq -r .data.token |base64 -D
# Decode it using Python (pip install PyJWT)
import jwt
jwt.decode(var, options={"verify_signature":False})
tuxfight3r / selfsigned-clusterissuer.yml
Last active Jul 15, 2021
kube cert-manager cert issuer
View selfsigned-clusterissuer.yml
kind: ClusterIssuer
name: selfsigned-cluster-issuer
selfSigned: {}
tuxfight3r /
Last active Jun 30, 2021
bash script to choose an option with dialog box
BACKTITLE="Cluster Options"
TITLE="Select Cluster"
MENU="Choose one of the following options:"
tuxfight3r /
Created May 7, 2021 — forked from ursuad/
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/ --zookeeper localhost:2181 --list

Describe a topic

bin/ --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/ --zookeeper localhost:2181 --alter --topic mytopic --config

... wait a minute ...

tuxfight3r /
Last active Mar 17, 2021
validating EC2 pem / ssh key pairs
## Get private key fingerprint for AWS generated key ( will match the id in AWS Console)
$ openssl pkcs8 -in test_key.pem -inform PEM -outform DER -topk8 -nocrypt | openssl sha1 -c
(stdin)= f6:38:9c:53:9c:64:a8:b3:40:23:9f:6c:ed:0e:3d:bf:bf:16:bb:1c

## Get fingerpint from Openssh public key only md5 / sha1
$ ssh-keygen -f -e -m PKCS8 | openssl pkey -pubin -outform DER | openssl md5 -c
(stdin)= 55:b6:90:db:34:29:da:60:68:c9:08:24:f1:9f:c8:4b

tuxfight3r /
Last active Mar 10, 2021
kubectl configmap json patch

use kubectl to patch configmap via json patch operations (add/remove/replace/test)

## Add a new key to the existing configmap
$ kubectl patch cm demo-app-config --type json --patch '[{ "op": "add", "path": "/data/TEST_VALUE", "value": "test_key" }]'
configmap/demo-app-config patched

$ kubectl get cm demo-app-config -o json | jq .data.TEST_VALUE
tuxfight3r /
Created Feb 24, 2021 — forked from sahilsk/
Apache Kafka Cheat Sheet

Kafka Cheat Sheet

Display Topic Information

$ --describe --zookeeper localhost:2181 --topic beacon
Topic:beacon	PartitionCount:6	ReplicationFactor:1	Configs:
	Topic: beacon	Partition: 0	Leader: 1	Replicas: 1	Isr: 1
	Topic: beacon	Partition: 1	Leader: 1	Replicas: 1	Isr: 1
tuxfight3r /
Created Feb 24, 2021 — forked from mjuric/
Useful Kafka wrangling commands

Utilities you'll care about

All these are already installed on epyc.

  • kafkacat (conda install -c conda-forge kafkacat)

  • kt (grab it from

  • kafka-* (come with kafka, if you yum install if from Confluent's repo, or via Docker if you're so inclined). Warning -- JVM based and dreadfully slow.

  • jq (conda install -c conda-forge jq or use your favorite package manager)

View avro_tricks.txt
# get schema
java -jar ../avro-tools-1.10.1.jar getschema twitter.avro
# get meta
java -jar ../avro-tools-1.10.1.jar getmeta twitter.avro
#create avro
java -jar ../avro-tools-1.10.1.jar fromjson --schema-file twitter.avsc twitter.json > twitter.avro
tuxfight3r / git-gpg-sign.txt
Created Feb 24, 2021
signing git commits with GPG keys.
View git-gpg-sign.txt
# generate a key if you don't have one already
gpg --full-gen-key
# list the keys in long format and copy the key id after sec rsa4096/<KEY>
gpg --list-secret-keys --keyid-format LONG
# export the public key and post into your git profile (ui)
gpg --armor --export 127CAA89CEA6BE66