Skip to content

Instantly share code, notes, and snippets.

View caleblloyd's full-sized avatar

Caleb Lloyd caleblloyd

View GitHub Profile
@caleblloyd
caleblloyd / values.yaml
Created June 14, 2024 20:32
Inject K8s Node Labels into NATS Config
config:
merge:
$include: server-tags/tags.conf
container:
patch:
- op: add
path: /volumeMounts/-
value:
name: server-tags
@caleblloyd
caleblloyd / bench.sh
Last active February 8, 2023 01:23
NATS Memory Benchmark
#!/bin/bash
msgs_per_publisher="1 10 100 1000"
publishers="1 10 100 1000"
mem_limits="33554432 67108864 134217728 268435456"
seconds=10
timeout_seconds=13
passed=""
# set to 1 to enable jetstream
@caleblloyd
caleblloyd / dns-sidecar.yaml
Created July 10, 2020 02:20
CoreDNS Caching Sidecar
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: busybox
spec:
replicas: 1
selector:
matchLabels:
app: busybox
version: v1
@caleblloyd
caleblloyd / Tampermonkey-Zoho-Expense-Auto-Reference.js
Last active January 4, 2021 16:20
Tampermonkey Zoho Expense Auto Reference
// ==UserScript==
// @name Zoho Expense Auto Reference
// @namespace https://boxboat.com/
// @version 0.1
// @description Auto add reference to Zoho Expense
// @author Caleb Lloyd
// @match https://expense.zoho.com/*
// @grant none
// ==/UserScript==
  1. Creates CA key
  2. Creates Server Key/Cert signed with CA Key
  3. Creates Client Key/Cert signed with CA Key

Usage:

./keys.sh [common name] [sans...]

Subdirectory named "certs" is removed and recreated each run

public override T GetFieldValue<T>(int ordinal)
{
try
{
return base.GetFieldValue<T>(ordinal);
}
catch (InvalidCastException e)
{
return ConvertWithReflection<T>(ordinal, e);
}
./stress.sh 3000 1s async2
Rate = 3000 RPS
Duration = 1s
Targets = targets-async2.txt
Requests [total, rate] 3000, 3001.00
Duration [total, attack, wait] 1.000210473s, 999.66543ms, 545.043µs
Latencies [mean, 50, 95, 99, max] 10.404817ms, 448.391µs, 70.46273ms, 115.09937ms, 139.388358ms
Bytes In [total, mean] 45288000, 15096.00
Bytes Out [total, mean] 0, 0.00
Success [ratio] 100.00%
@caleblloyd
caleblloyd / _Dreamhost_Dynamic_DNS.md
Last active May 1, 2019 00:22
Dreamhost API Dynamic DNS cron script
  1. sign up for a dreamhost API Key with "All DNS" permissions at https://panel.dreamhost.com/index.cgi?tree=home.api
  2. copy config.sh to /etc/dreamhost/config.sh and fill out the variables
  3. copy ddns.sh to /usr/local/dreamhost/ddns.sh
  4. copy dreamhost_cron to /etc/cron.d/dreamhost_cron
@caleblloyd
caleblloyd / _README.md
Last active June 24, 2016 14:23
.NET Core remote debugging in Docker with VS Code

Assumptions:

Instructions:

  1. Copy get-clrdbg.sh script into docker container, make executable, and run it. It will install clrdbg to /usr/local/bin
  2. Copy debug.sh to docker container at /root/debug.sh and make executable

Google Compute Engine NFS Container VM

This script creates a Container VM on Google Compute Engine running a NFS V4 server exposed on Port 2049 with the /exports directory mounted to a persistent disk. This means:

  • If the NFS VM Crashes, the persistent disk will still hold the NFS Files
  • The persistent disk can be snapshotted to backup NFS Files

To run: