Skip to content

Instantly share code, notes, and snippets.

View saumas's full-sized avatar

Saulius Mašnauskas saumas

  • Vilnius, Lithuania
  • 04:40 (UTC +02:00)
View GitHub Profile
@saumas
saumas / .zshrc
Created October 15, 2025 12:47
Discord Timestamp Utility
# Discord timestamp helper: dt <datetime> [style]
# datetime examples: 2025-10-15T13:00Z | 2025-10-15T13:00+0000 | unix-epoch | "now"
# style: F f t T d D R (default: F)
dt() {
local input="$1"
local style="${2:-F}"
local epoch=""
local out=""
if [[ -z "$input" ]]; then
@saumas
saumas / gpg.sh
Last active January 6, 2025 09:19
Configure a new GPG key for signing your commits
# Generate a new key. Suggestion is to use RSA 4096. Enter your name and email when prompted.
gpg --full-gen-key
# Get the ID of the generated key
GPG_KEY_ID=$(gpg --list-secret-keys --keyid-format LONG "your@email.address" | awk '/^sec/ {split($2, a, "/"); print a[2]}')
# Export the key which you will need to copy to your user settings in your repository (GitHub, GitLab, etc.)
gpg --armor --export $GPG_KEY_ID
# Tell git you want to sign all of your commits from now on. If you always use the same user, then use `--global` instead of `--local`.
@saumas
saumas / gist:a0a9303f0e941bf33f1e49beab5fc0d2
Created August 7, 2023 14:22
Make zsh expand dynamic Makefile targets when pressing Tab
# Append .zshrc with
zstyle ':completion:*:make:*:targets' call-command true
zstyle ':completion:*:*:make:*' tag-order 'targets'
@saumas
saumas / create.sh
Last active February 11, 2025 03:34
Create an admin kubeconfig
#!/usr/bin/env bash
set -ex
NAMESPACE="default"
NAME="admin"
SECRET_NAME="admin-secret"
kubectl create serviceaccount -n $NAMESPACE $NAME
kubectl create clusterrolebinding $NAMESPACE-$NAME --clusterrole=cluster-admin --serviceaccount=$NAMESPACE:$NAME