Skip to content

Instantly share code, notes, and snippets.

View epcim's full-sized avatar

Petr Michalec epcim

View GitHub Profile
@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 / kubernetes_pods_docker_disk_usage.md
Last active September 10, 2024 02:23
docker disk space introspection kubernetes docker overlay

identify big pods/containers

investigage big files

DST=/mnt
find /var/lib -type f -size +1G -exec ls -lh {} \; | tee  $DST/bigfiles_var_lib_$(date "+%H%M").log
find /var/lib -type f -size +1G -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -rh > $DST/bigfiles_var_lib_$(date "+%H%M").sorted.log

misbehave processes

@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
@epcim
epcim / update-ca-certificates.md
Last active August 19, 2024 09:05
trusted certificates system update-ca-certificates

Adding trusted root certificates to the server

Mac OS X

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ~/new-root-certificate.crt
sudo security delete-certificate -c "<name of existing certificate>"

Windows

certutil -addstore -f "ROOT" new-root-certificate.crt

@epcim
epcim / ovpn_easyrsa_pki.md
Last active August 11, 2024 00:54
openvpn easy-rsa certs (+revoke)
@epcim
epcim / pass-getting-started.md
Created March 17, 2023 13:39 — forked from layoaster/pass-getting-started.md
Cheat sheet/ getting-started guide to pass

pass cheat sheet/guide

Getting started guide to the unix password manager pass. Manage gpg encripted passwords (files) in a standar directory-like hierarchy. Such files can be copied or stored in a git repository.

Requirements

  1. Install [pass][pass-homepage] (standard unix password manager):

Ubuntu/Debian:

$ sudo apt-get install pass
@epcim
epcim / action_gnutls_scripted.md
Last active February 3, 2024 18:50
gnutls certtool ssl tls openssl

CA - based on gnutls-bin


this directory holds CA key + wildcard certificates created for new infrastructure the CA key/cert is "ca-cert.pem/key"

TODO:

  • create scripts to re-generate client certificates based on NEW CA
  • develop procedure to generate client/server certs from template (partialy done)
  • develop procedure to generate clr files + revocate certificate + distribute them on public places
@epcim
epcim / sed-mutli-line-replacement-between-two.md
Last active February 1, 2024 08:40
sed regex class keywords for replace

add sign/stamp to PDF files

First convert the image to PDF

convert image.png image.pdf

Then scale up and offset the image using pdfjam (another free tool)

pdfjam --paper 'a4paper' --scale 0.3 --offset '7cm -12cm' image.pdf

❯ sudo sntp -sS time.apple.com
Password:
+9763418.309211 +/- 0.019967 time.apple.com 17.253.14.253