Skip to content

Instantly share code, notes, and snippets.

View NickLarsenNZ's full-sized avatar
🦀

Nick NickLarsenNZ

🦀
View GitHub Profile
@NickLarsenNZ
NickLarsenNZ / replicated.nix
Created July 25, 2024 20:38
Replicated CLI for Nix
{ stdenv
, lib
, fetchurl
, installShellFiles
}:
stdenv.mkDerivation rec {
pname = "replicated";
version = "0.78.0";
@NickLarsenNZ
NickLarsenNZ / main.rs
Created June 30, 2024 21:08
Async JoinSet with Semaphores to limit concurrent tasks
use std::{error::Error, sync::Arc, time::Duration};
use tokio::{sync::Semaphore, task::JoinSet};
use tracing_subscriber::fmt::format::FmtSpan;
type Result<T, E = Box<dyn Error>> = std::result::Result<T, E>;
const CONCURRENCY: usize = 2;
#[tokio::main(flavor = "current_thread")]
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