Add the decode_jwt script.

This commit is contained in:
Tom Alexander
2026-05-06 09:49:47 -04:00
parent 9a9268f8cc
commit 856e4daee6
3 changed files with 14 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ let
cleanup_temporary_files = (
patchScriptBin "cleanup_temporary_files" (builtins.readFile ./files/cleanup_temporary_files.bash)
);
decode_jwt = (patchScriptBin "decode_jwt" (builtins.readFile ./files/decode_jwt.bash));
alias_rga = pkgs.writeShellScriptBin "rga" ''
exec ${pkgs.ripgrep}/bin/rg -uuu "''${@}"
'';
@@ -59,6 +60,7 @@ in
nix-output-monitor # For better view into nixos-rebuild
# nix-serve-ng # Serve nix store over http
cleanup_temporary_files
decode_jwt
jq
inetutils # For whois
];

View File

@@ -1,4 +1,7 @@
#!/usr/bin/env bash
#
# Delete temporary files on entire disk
find / -type f '(' -name '*.orig' -or -name '*~' -or -name '*.core' ')' -delete -print 2>/dev/null
set -euo pipefail
IFS=$'\n\t'
exec find / -type f '(' -name '*.orig' -or -name '*~' -or -name '*.core' ')' -delete -print 2>/dev/null

View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
#
# Decode the contents of a JWT
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
exec jq -R 'split(".") | .[0],.[1] | gsub("-"; "+") | gsub("_"; "/") | gsub("%3D"; "=")| @base64d | fromjson'