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 / s3-object-upload.sh
Created April 8, 2020 06:43
If you are using customer managed KMS keys for encrypting data on S3 you must then specify the server-side-encryption option
#!/bin/bash
# MUST specify --server-side-encryption aws:kms if you are using customer managed
# encryption keys. Not needed if using S3 default encryption keys
aws s3api put-object --bucket bucket --key objectKey --body /path/to/file --server-side-encryption aws:kms
@BenSlabbert
BenSlabbert / get-config.sh
Created April 3, 2020 11:01
microk8s get kubectl config
#!/bin/bash
microk8s.kubectl config view --raw
@BenSlabbert
BenSlabbert / update-modules.sh
Created April 3, 2020 11:00
update all go modules
#!/bin/bash
go list -m -u all
@BenSlabbert
BenSlabbert / echo-server.sh
Created March 20, 2020 08:40
nice echo server
#!/bin/bash
docker container run --rm -d -p 8080:8080 gcr.io/google_containers/echoserver:1.4
@BenSlabbert
BenSlabbert / get-number-of-pods.sh
Created March 17, 2020 10:57
returns the number of pocs that can be scheduled on a k8s node
#!/bin/bash
kubectl get nodes -o json | jq -r .items[].status.allocatable.pods | paste -sd+ - | bc
@BenSlabbert
BenSlabbert / get-octal-file-perms.sh
Created March 11, 2020 10:15
display file permissions in octal format
#!/bin/bash
# https://unix.stackexchange.com/questions/188674/how-to-get-file-permission-in-octal
stat -c "%a" file
@BenSlabbert
BenSlabbert / scp-file.sh
Created February 26, 2020 13:02
scp file from remote to local with ssh id key
#!/bin/sh
scp -i SSH_PEM_KEY USERNAME@IP_ADDRESS:PATH_TO_FILE PATH_TO_DESTINATION
@BenSlabbert
BenSlabbert / convert-key.sh
Created February 26, 2020 12:44
convert an OPENSSH private key to an RSA private key
#!/bin/bash
sudo apt install putty
puttygen OPENSSH_KEY -O private-sshcom -o NEW_KEY
ssh-keygen -i -f NEW_KEY > RSA_FORMATTED_KEY
@BenSlabbert
BenSlabbert / program-port.sh
Created February 21, 2020 12:50
get list of programs using specific port
#!/bin/bash
lsof -i :8080
@BenSlabbert
BenSlabbert / .pre-commit-config.yaml
Created February 21, 2020 12:47
call make target from pre-commit
repos:
- repo: local
hooks:
- id: make
language: system
name: make
entry: make <your target here>