Skip to content

Instantly share code, notes, and snippets.

View epcim's full-sized avatar

Petr Michalec epcim

View GitHub Profile
@epcim
epcim / .envrc
Created November 24, 2026 14:15
envrc, direnv, .env & .sops.env variables load
source_up
dotenv
source_env_if_exists .envrc.local
# Sops
if [[ -f .sops.yaml ]]; then
export SOPS_CONFIG="$PWD/.sops.yaml"
fi
# Load encrypted ENVs
@epcim
epcim / gist:16e7c085bb00e8b9a92821d5f46f9229
Created November 17, 2026 14:16
yubikey, generate age key
brew install age-plugin-yubikey age
mkdir -p ~/.config/sops/age
SLOT=1
age-plugin-yubikey --generate \
--slot $SLOT \
--name "age yk-xyz" \
--pin-policy once \
--touch-policy always \
@epcim
epcim / gist:e97200d5ecd001c5005871b8ad7c8252
Created November 17, 2026 14:13
yubikey sops, update secrets
find . -type f -name "*.yaml" -exec grep -l "sops:" {} + | xargs -I {} sops updatekeys -y "{}"
# Find budle ca store for updates:
grep -i "AUTOUPDATECERTSDIR=" /usr/syno/bin/update-ca-certificates.sh
# Remove the compromised root certs
rm /var/db/ca-certificates/emSign_Root_CA_-_G1.crt
rm /var/db/ca-certificates/emSign_Root_CA_-_C1.crt
rm /var/db/ca-certificates/emSign_ECC_Root_CA_-_G3.crt
rm /var/db/ca-certificates/emSign_ECC_Root_CA_-_C3.crt
rm /var/db/ca-certificates/Comodo_AAA_Services_root.crt
@epcim
epcim / gopass_export.sh
Created September 18, 2026 14:12
export gopass, to bitwarden civ
#!/bin/bash -e
# THE SIMPLE SPARTA WAY, BE CAREFULL
# UPDATE stores/root as per your needs
# 1. Define paths (Change these if your paths are non-default)
STORE_DIR="$HOME/.local/share/gopass/stores/root" # Check ~/.password-store if not here
AGE_KEY="$HOME/.config/gopass/age/identities" # Your private age identity key
age -d -o $AGE_KEY.temp $AGE_KEY || exit 1
@epcim
epcim / gist:479188c2a98468ed9c0187386a54e23a
Created April 1, 2026 05:44
keyring, secrets management and CLI
# gopass
EDITOR=vi gopass insert me/api/xyz_api_key
XYZ_API_KEY="$(gopass -o me/api/xyz_api_key)"
# python
python -m keyring set XYZ_API_KEY <username>
python -m keyring get XYZ_API_KEY <username>
# MacOS
get_secret() {
#!/bin/bash
# List the blobs in an Azure storage container.
echo "usage: ${0##*/} <container-name> [blob-name]"
storage_account="$AZURE_STORAGE_ACCOUNT"
container_name="$1"
access_key="$AZURE_STORAGE_KEY"
@epcim
epcim / gist:f271212e031202d040ff8128804d4b40
Created September 15, 2024 06:56
stop disk in linux - hot swap
# for hdd
device=sata4; sudo sh -c "echo 1 > /sys/block/${device}/device/delete"
# for usb
udisksctl power-off -b /dev/sdd
@epcim
epcim / uploads-per-month.txt
Last active August 22, 2024 08:15
gcr.io image statistics
for REPO in $(gcloud alpha container images list --repository=gcr.io/volterraio --sort-by="~TIMESTAMP"|grep -Ev '^NAME'); do \
gcloud container images list-tags $REPO --format="table[no-heading](DIGEST,TIMESTAMP)"|\
grep 2024-08 | xargs -I% echo $(basename $REPO) %; done |\
clipivot count --rows=0 --val=3 |sort -g -t, -k2 -r |head -n 50
❯ sudo sntp -sS time.apple.com
Password:
+9763418.309211 +/- 0.019967 time.apple.com 17.253.14.253