Skip to content

Instantly share code, notes, and snippets.

View schwabix's full-sized avatar
🎸
rock 2020

Michael Steinlechner schwabix

🎸
rock 2020
  • Schwabix
  • Munich
View GitHub Profile
@schwabix
schwabix / dump-secrets.sh
Created July 8, 2024 13:53
Dump all secrets in namespacce
#!/bin/sh
kubectl -n <NS> get secret -o custom-columns=:.metadata.name,:.metadata.namespace --no-headers | xargs -n 2 sh -c '(kubectl get secret -n $3 -o yaml $2) > $2.yaml'
-- {}
@schwabix
schwabix / validate-ssl-public-with-private-key.sh
Created November 19, 2021 12:08
Validate SSL public with private key
# MD5 für Public Key
openssl x509 -noout -modulus -in cert.pem | openssl md5
# MD5 für Private Key
openssl rsa -noout -modulus -in key.pem | openssl md5
#!/bin/env bash
while read image; do
original_image="old.repo.domain/${image}"
target_image="new.repo.domain/${image}"
# download all tags images
docker pull $original_image --all-tags

Keybase proof

I hereby claim:

  • I am schwabix on github.
  • I am schwabix (https://keybase.io/schwabix) on keybase.
  • I have a public key whose fingerprint is 85F5 B0BB E34A AF68 C3A2 2B64 80DE 3E43 8A87 CBA8

To claim this, I am signing this object:

#!/usr/bin/env bash
git init --bare ~/.dotfiles
alias dotgit='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
echo "alias dotgit='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >> ~/.bashrc
dotgit config status.showUntrackedFiles no
#!/bin/sh
losetup -f
# output eg. /dev/loop0
losetup /dev/loop0 my-image-file.img # link image file with loop drive
kpartx -av /dev/loop0 # creates lvm drives for partitions
mount /dev/mapper/loop0p1 /mnt/image # for first partition
# unmount
mysqldump -u<USER> -h<HOST> -p --lock-tables=false <DB> -r dump.sql
mysql -u<USER> -p --default-character-set=utf8 <DB>
mysql> SET names 'utf8';
mysql> SOURCE dump.sql
@schwabix
schwabix / socat-tar-backup.sh
Last active October 29, 2022 00:28
SOCAT - Send TAR of current directory to remote host
# SERVER - BACKUP HOST
socat -u TCP-LISTEN:9876,reuseaddr OPEN:<FILENAME>,creat,largefile
# CLIENT
tar cvzf - ./* | socat -u STDIN TCP:<BACKUP_HOST>:9876,sndbuf=67108864,dontroute
@schwabix
schwabix / test-mail-server.sh
Last active September 19, 2019 09:32
Howto test secure connection to email server
#SSL
openssl s_client -connect <MAIL_HOST>:465 -crlf -ign_eof
#StartTLS
openssl s_client -connect <MAIL_HOST>:25 -starttls smtp
#Without security
telnet <MAIL_HOST> 25