Skip to content

Instantly share code, notes, and snippets.

View joemiller's full-sized avatar

joe miller joemiller

View GitHub Profile
@joemiller
joemiller / git-diff-size-check-total-only.rb
Last active May 16, 2026 17:06
proof of concept script for checking the size of staged git commits and rejecting based on individual file or overall total
#!/usr/bin/env ruby
MAX_DIFF_SIZE_MB = 4 # MB
def bytes_to_mb(bytes)
bytes.to_f / (1024*1024)
end
total_diff_bytes = 0
@joemiller
joemiller / Dockerfile
Last active May 6, 2026 17:37
convert RFC 3164 syslog messages to RFC 5424 for ingestion into Loki/promtail
FROM balabit/syslog-ng:3.35.1
COPY syslog-ng.conf /etc/syslog-ng/syslog-ng.conf
@joemiller
joemiller / git-sign-pr
Last active February 22, 2026 16:06
`git sign <PR#>` - resign all commits in a github PR with your gpg/ssh key
#!/usr/bin/env bash
set -eou pipefail
TMPDIR=""
GREEN=$'\033[32m'
RESET=$'\033[0m'
msg() { echo "${GREEN}==> $1${RESET}"; }
usage() {
#!/usr/bin/env bash
set -eou pipefail
TMPDIR=""
GREEN=$'\033[32m'
RESET=$'\033[0m'
msg() { echo "${GREEN}==> $1${RESET}"; }
main() {
@joemiller
joemiller / auto_shutdown.service
Last active December 16, 2025 15:47
bash script + systemd units for auto-shutting down an idle machine (no active ssh logins)
[Unit]
Description=Auto shutdown service
[Service]
Type=oneshot
ExecStart=/auto_shutdown.sh
@joemiller
joemiller / he-dns-update.sh
Last active October 28, 2025 09:36
script for updating dynamic DNS records on he.net (hurricane electric)
#!/bin/bash
#
# Script for updating DNS records on Hurricane Electirc's DNS system (https://dns.he.net).
#
# The record will be updated with the IP address that originates the request.
#
# Usage
# -----
#
# Create config file `/etc/he-dns-update.conf`:

Loki log ingestion issue

Loki stops ingesting logs from promtail. The error messages are a stream HTTP 499 errors in the gateway component which is based on nginx. Ex:

10.194.148.169 - - [17/Feb/2022:21:08:28 +0000]  499 "POST /loki/api/v1/push HTTP/1.1" 0 "-" "promtail/" "-"
10.194.90.195 - - [17/Feb/2022:21:08:28 +0000]  499 "POST /loki/api/v1/push HTTP/1.1" 0 "-" "promtail/" "-"
@joemiller
joemiller / cert-renewal-visualizer.html
Created June 11, 2025 22:58
Certificate Renewal Timeline visualizer (developed by Claude. Used to simulate CA + leaf renewal with cert-manager which does NOT clamp leaf expiration to CA expiration)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Certificate Renewal Timeline Visualizer</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
margin: 0;
@joemiller
joemiller / userscript.js
Last active May 28, 2025 21:47
Tampermonkey script to add "select all / deselect all' buttons to Buildkite's `input` modal when used with multiple selections
// ==UserScript==
// @name Buildkite Select All Button
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Adds a "Select All" button to Buildkite pipeline input modals (skips "!! APPLY ALL STACKS !!")
// @author You
// @match https://buildkite.com/*
// @grant none
// ==/UserScript==
@joemiller
joemiller / mk-test-certs.sh
Created December 29, 2015 22:32
helper script for making a new CA and signing client (leaf) certs, including making java keystore (JKS) files. useful in creating test fixtures
#!/bin/sh
# helper script for making a new CA and signing client (leaf) certs, including making java keystore (JKS) files. useful in creating test fixtures
#
# Example:
# ./mk-test-certs.sh
# ==> Creating new CA: certs/ca.key, certs/ca.crt
# Generating a 2048 bit RSA private key
# ....................................................+++
# ...............................+++
# writing new private key to 'certs/ca.key'