Skip to content

Instantly share code, notes, and snippets.

View BenSlabbert's full-sized avatar
🎯
Focusing

Ben BenSlabbert

🎯
Focusing
  • München, Germany
View GitHub Profile
@BenSlabbert
BenSlabbert / ec2-local-port-forward.sh
Created March 1, 2021 15:52
port forward the local port on an ec2 instance to local machine
#!/bin/bash
# port forward port 5601 to localhost:5601
ssh -i id_rsa -L 127.0.0.1:5601:localhost:5601 ec2-user@some_ip
@BenSlabbert
BenSlabbert / mysql-ssl-rds.sh
Created January 13, 2021 14:17
mysql ssl connection with rds
#!/bin/bash
curl -O https://s3.amazonaws.com/rds-downloads/rds-ca-2019-eu-central-1.pem
mysql -h DB_HOST -u USER_NAME -p --ssl-ca=/rds-ca-2019-eu-central-1.pem
@BenSlabbert
BenSlabbert / k8s-set-deployment-env.sh
Created October 14, 2020 12:12
use kubectl to set the value of an env variable in a deployment
#!/bin/bash
kubectl set env deploy DEPLOYMENT_NAME ENV_KEY=ENV_VALUE
@BenSlabbert
BenSlabbert / docker-ping.sh
Created October 12, 2020 08:39
ping docker
#!/bin/bash
# ping from unix socket
curl --unix-socket /var/run/docker.sock http://localhost/_ping
@BenSlabbert
BenSlabbert / aws-s3-cp.sh
Created October 5, 2020 17:22
aws-s3-cp
#!/bin/bash
# copy contents for dir recursively to s3 bucket specifying encryption key
aws s3 cp $PATH_TO_DIR s3://$BUCKET --recursive --profile $AWS_PROFILE --sse aws:kms
@BenSlabbert
BenSlabbert / creat-file-from-cat.sh
Created August 10, 2020 11:56
create a file with cat
#!/bin/bash
cat <<EOF >hello.txt
# input file content here
# stop input with EOF
@BenSlabbert
BenSlabbert / java.net debugging
Created July 22, 2020 09:00
java network debugging
run the JAR with the option: -Djavax.net.debug=all to help debug SLL/network issues
see: https://stackoverflow.com/a/6353956/4841710
and: https://stackoverflow.com/a/62244399/4841710 for possible remedy if ussing custom runtime
@BenSlabbert
BenSlabbert / nested_context_with_cancel.go
Created June 3, 2020 12:13
golang nesting conexts with cancel
package main
import (
"context"
"fmt"
"time"
)
func main() {
rollUp()
#!/bin/bash
git push --delete origin tagname
git push origin :refs/tags/tagname
git tag --delete tagname
@BenSlabbert
BenSlabbert / pgp-tips.md
Created April 23, 2020 15:50
gpg helpful commands

get fingerprint of a key

cat file.gpg | gpg --with-colons --import-options show-only --import

get fingerprints of imported keys

gpg --fingerprint

get recipients of encrypted payload