Skip to content

Instantly share code, notes, and snippets.

View trutzonline's full-sized avatar

Christian Trutz trutzonline

View GitHub Profile
@trutzonline
trutzonline / privacy.sh
Created August 22, 2025 09:50
RSA encryption and decryption
# generate rsa keypair
openssl genrsa -out keypair.pem 4096
# display public key
openssl rsa -in keypair.pem -pubout
# encrypt plain text
openssl rsautl -encrypt -pubin -inkey alice-public.pem -in plain.txt | base64 > encrypted.txt
# decrypt encrypted test
@trutzonline
trutzonline / ca
Last active December 28, 2024 17:54
create CA (certificate authority), server and client certificate for TLS communication
#!/bin/bash
if [ -n "$1" ]; then
BASE_DIR="$1"
if [ ! -d "$BASE_DIR" ]; then
echo "$BASE_DIR does not exist and will be created"
mkdir -p -v $BASE_DIR
fi
else
BASE_DIR="."
@trutzonline
trutzonline / alias.sh
Created March 16, 2021 06:09
Git alias
# Commit Id of HEAD
git rev-parse HEAD
# Find all children of HEAD
git rev-list --children --all | grep $(git rev-parse HEAD) | head -1
# Find first child of HEAD (children[1] is the Commit Id of HEAD)
git rev-list --children --all | grep $(git rev-parse HEAD) | head -1 | awk '{split($0,children," "); print children[2]}'
# Checkout fist child commit
@trutzonline
trutzonline / create-k8s-cluster-do.sh
Last active February 14, 2020 15:45
New Kubernetes cluster on Digital Ocean
# create cluster via website
doctl kubernetes cluster kubeconfig save [clustername]
kubectl cluster-info
# install cert-manager
kubectl apply --validate=false -f https://raw.githubusercontent.com/jetstack/cert-manager/v0.13.0/deploy/manifests/00-crds.yaml
kubectl create namespace cert-manager
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install cert-manager jetstack/cert-manager --namespace cert-manager --version v0.13.0
@trutzonline
trutzonline / brew.sh
Last active February 13, 2020 21:14
kubernetes cluster setup
# see also https://brew.sh/
# fetch the newest version of Homebrew
brew update
# upgrade outdated, unpinned formulae using the same options they were originally installed with
brew upgrade
@trutzonline
trutzonline / git-repos-konsolidieren.sh
Created January 28, 2019 05:36
Git Repositories konsolidieren
git remote add other /path/to/XXX
git fetch other
git checkout -b ZZZ other/master
mkdir ZZZ
git mv stuff ZZZ/stuff # repeat as necessary for each file/dir
git commit -m "Moved stuff to ZZZ"
git checkout master
git merge ZZZ --allow-unrelated-histories # should add ZZZ/ to master
git commit
git remote rm other
@trutzonline
trutzonline / imageToText.gs
Created March 16, 2017 15:12 — forked from tagplus5/imageToText.gs
google apps script image to text ocr
function doGet(request) {
if (request.parameters.url != undefined && request.parameters.url != "") {
var imageBlob = UrlFetchApp.fetch(request.parameters.url).getBlob();
var resource = {
title: imageBlob.getName(),
mimeType: imageBlob.getContentType()
};
var options = {
ocr: true
};