Skip to content

Instantly share code, notes, and snippets.

View NickLarsenNZ's full-sized avatar
🦀

Nick NickLarsenNZ

🦀
View GitHub Profile
bind-key D run-shell 'tmux send-keys $(date +%F)'
@NickLarsenNZ
NickLarsenNZ / responders.yaml
Created October 8, 2020 21:16
mockhttp responders for for Kafka Connect API
responders:
# https://docs.confluent.io/current/connect/references/restapi.html#get--
- when:
http:
method: GET
path: /
then:
http:
status: 200
@NickLarsenNZ
NickLarsenNZ / apply.log
Created April 15, 2020 01:16
Terraform Provider SDK Bug
2020/04/15 13:15:04 [INFO] Terraform version: 0.12.21
2020/04/15 13:15:04 [INFO] Go runtime version: go1.12.13
2020/04/15 13:15:04 [INFO] CLI args: []string{"/Users/nick/bin/terraform", "apply", "-auto-approve"}
2020/04/15 13:15:04 [DEBUG] Attempting to open CLI config file: /Users/nick/.terraformrc
2020/04/15 13:15:04 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/04/15 13:15:04 [DEBUG] checking for credentials in "/Users/nick/.terraform.d/plugins"
2020/04/15 13:15:04 [INFO] CLI command args: []string{"apply", "-auto-approve"}
2020/04/15 13:15:04 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/04/15 13:15:04 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/04/15 13:15:04 [DEBUG] New state was assigned lineage "54749269-c69a-db76-7b76-9c2893526dd3"
@NickLarsenNZ
NickLarsenNZ / inventory.tf
Last active February 25, 2020 07:08
Coudera Ansible Inventory Generation
resource "local_file" "inventory" {
content = templatefile("templates/inventory.tmpl", {
# map(string)
vars = var.global_vars
# string
scm_server = var.scm_server
db_server = var.db_server
krb5_server = var.krb5_server
fun main() {
val numbers = listOf(
12,
7476589,
97462994,
37837,
38840184,
2848493,
1847479
)
kubectl get pods prometheus-prometheus-0 -o yaml | yq -y '.spec.securityContext'
runAsNonRoot: true
runAsUser: 1000

Kubernetes Tips

Check TLS certifiacte DNS names from a secret

kubectl get secrets local-etcd-0 -o go-template='{{index .data "tls.crt"}}' | base64 -d | openssl x509 -noout -text | grep DNS:

Mutual TLS verification

@NickLarsenNZ
NickLarsenNZ / ado_bump.sh
Last active November 4, 2020 01:25
Automatically bump the semantic version tag if there are changes since the last (with discrimination between major, minor, patch bumps from comments)
# https://gist.github.com/NickLarsenNZ/ee907e05429a02fb6f2bcc73e7c34733
set -euo pipefail
COMMIT_MESSAGES=""
LAST_TAG=$(git describe --abbrev=0 --tags 2>/dev/null)
if [ -z "$LAST_TAG" ]; then
>&2 echo "No tags previously defined"
LAST_TAG="0.0.1"
# Get commit logs for all time
@NickLarsenNZ
NickLarsenNZ / kafka-consumer.py
Last active October 23, 2023 09:55
A small Kafka producer and consumer example
#!/usr/bin/env python3
# Usage:
# pip install kafka-python
# ./consumer.py <my-topic>
# NOTE: only runs for 10 seconds as per consumer_timeout_ms
# See:
# - https://raw.githubusercontent.com/simplesteph/kafka-stack-docker-compose/master/zk-multiple-kafka-multiple.yml