Skip to content

Instantly share code, notes, and snippets.

@jumpingElephant
jumpingElephant / decodeJWT.sh
Created October 2, 2025 15:32
Decode JWT in Terminal
#!/usr/bin/env bash
set -euo pipefail
function printJwt {
# Split the line on '.'.
IFS='.' read -a PARTS <<< "$1"
echo 'Header:'
echo "${PARTS[0]}" | base64 -d | jq
echo 'Payload:'
@jumpingElephant
jumpingElephant / sudoers.md
Last active August 31, 2025 12:30
sudo password timeout
@jumpingElephant
jumpingElephant / generate-secret.sh
Last active January 1, 2024 09:48
Function to generate secrets in my Z shell configuration
# generate-secret [length]
function generate-secret {
length="${1:-20}"
</dev/urandom tr -dc '_!@#$%A-Z-a-z-0-9' | head -c$length | xargs -I{} echo "{}" | sed 's/[[:space:]]*$//' | tr -d '\n' | xclip -selection clipboard -f; echo ""
}