Skip to content

Instantly share code, notes, and snippets.

@tyzbit
tyzbit / Docker Style Guide.md
Created May 10, 2018 18:23
Docker Style Guide

Docker Style Guide

This is meant as a non-exhaustive set of tips to writing clean, usable Dockerfiles.

Before you start

It's assumed you're at least a little familiar with Docker's best practices document, especially using multi-stage builds. This is meant not to replace, but augment. I will reiterate some of these points to point out particularly useful or powerful conventions.

Minimize your layers as much as possible

@tyzbit
tyzbit / output
Created February 25, 2022 20:50
fio output
$ sudo fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=fiotest --filename=testfio --bs=4k --iodepth=64 --size=8G --readwrite=randrw --rwmixread=75
fiotest: (g=0): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=64
fio-3.16
Starting 1 process
fiotest: Laying out IO file (1 file / 8192MiB)
Jobs: 1 (f=1): [m(1)][100.0%][r=511MiB/s,w=170MiB/s][r=131k,w=43.4k IOPS][eta 00m:00s]
fiotest: (groupid=0, jobs=1): err= 0: pid=2634098: Fri Feb 25 20:47:34 2022
read: IOPS=130k, BW=510MiB/s (534MB/s)(6141MiB/12049msec)
bw ( KiB/s): min=465664, max=565208, per=99.99%, avg=521844.38, stdev=27636.21, samples=24
iops : min=116416, max=141302, avg=130461.08, stdev=6909.07, samples=24
@tyzbit
tyzbit / helmrelease.yml
Created February 15, 2022 20:29
Longhorn RecurringJobs HelmRelease
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: longhorn-recurring-jobs
namespace: flux-system
spec:
targetNamespace: longhorn-system
releaseName: longhorn-recurring-jobs
chart:
spec:
@tyzbit
tyzbit / .zshrc
Created November 10, 2021 18:02
Kubernetes TCP proxy
function kubeproxy() {
setopt local_traps
pod_name="socat-$(whoami)"
if [[ "${2}x" == "x" ]]; then
echo "Usage: kubeproxy [Hostname] [Port]"
return 0
fi
if kubectl run --restart=Never --image=alpine/socat $pod_name -- -d -d tcp-listen:$2,fork,reuseaddr tcp-connect:$1:$2; then
while [[ $(kubectl get pod $pod_name -o json | jq -r '.status.phase') != "Running" ]]; do
sleep 0.1
@tyzbit
tyzbit / query.md
Last active October 21, 2021 13:52
New Relic Days until k8s Volume is full (reaches 99%)
FROM K8sVolumeSample 
SELECT min(fsAvailableBytes / 1024 / 1024 / 1024) as 'GiB Free',
       clamp_min(
         (100 - 1 - stddev(fsUsedPercent) - max(fsUsedPercent))
           /
         clamp_min(
           deriv(fsUsedPercent, 1 days)
         ,0.00000313)
 ,0) as 'Days until full'
192.168.206.67 - - [28/Sep/2021:06:50:10 +0000] "GET /v1 HTTP/1.1" 200 3871 "" "Go-http-client/1.1"
192.168.206.67 - - [28/Sep/2021:06:50:10 +0000] "GET /v1 HTTP/1.1" 200 3871 "" "Go-http-client/1.1"
192.168.206.67 - - [28/Sep/2021:06:50:10 +0000] "GET /v1 HTTP/1.1" 200 3871 "" "Go-http-client/1.1"
192.168.206.67 - - [28/Sep/2021:06:50:10 +0000] "GET /v1 HTTP/1.1" 200 3871 "" "Go-http-client/1.1"
192.168.206.67 - - [28/Sep/2021:06:50:10 +0000] "GET /v1 HTTP/1.1" 200 3871 "" "Go-http-client/1.1"
fatal error: concurrent map writes
/usr/local/go/src/runtime/panic.go:1114 +0x72 fp=0xc001edd760 sp=0xc001edd730 pc=0x4348e2
runtime.throw(0x1b8963e, 0x15)
goroutine 1151041 [running]:
@tyzbit
tyzbit / plex-dashboard.xml
Last active September 14, 2021 22:54 — forked from Dirrk/plex-dashboard.xml
splunk dashboard for plex
<dashboard>
<label>my-plex-dashboard</label>
<row>
<panel>
<chart>
<title>Plex memory usage - 6 hours</title>
<search>
<query>index="os" source=ps COMMAND=Plex | rex field=ARGS ".*?-i_.*\/media\/.*\/(?&lt;t_file&gt;.*?)_-(?:filter|map_inline|map_[\d])" | rex field=ARGS "Plug.*\/(?&lt;plugin_name&gt;.*)$" | eval memMB=mem_used/1048576 | eval name=if(ARGS LIKE "New_Transcoder%",if(isnull(t_file),"Unknown Video Source",t_file),if(ARGS LIKE "Plug-in%", plugin_name, ARGS)) | timechart limit=20 avg(memMB) by name</query>
<earliest>-6h</earliest>
<latest>now</latest>
@tyzbit
tyzbit / configuration.yaml
Created August 2, 2021 20:23
Home Assistant KP115 config
tplink:
discovery: false
switch:
- host: 192.168.1.10
- host: 192.168.1.11
- host: 192.168.1.12
- host: 192.168.1.13
sensor:
- platform: template
@tyzbit
tyzbit / Useful lncli aliases.md
Last active July 24, 2021 23:57
Useful commands/aliases for interacting with LND using lncli (https://github.com/lightningnetwork/lnd)

I am not responsible, directly or indirectly for the loss of funds using these commands. Use at your own risk.

Informational Commands

lrecv

Channels with received satoshis

alias lrecv="lncli listchannels | jq '[ .channels | .[] | select(.total_satoshis_received|tonumber>0) ]'"

loffchain

Channels with offchain transactions

@tyzbit
tyzbit / discord commands.md
Last active March 31, 2021 14:42
Discord Commands

General Dyno commands can be found here

https://www.dynobot.net/commands


Toggleable server roles (so people can use @[role] to ping you)

Command Role Additional Permissions