Skip to content

Instantly share code, notes, and snippets.

View rasschaert's full-sized avatar

Kenny Rasschaert rasschaert

View GitHub Profile
@rasschaert
rasschaert / tml.pub
Created December 5, 2022 08:45
My TML Public SSH key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCUHHd6nFReUsxEaCj67lWWvmAFBPDAdGcC253y7W+ipbdf4+AVXi1K5e6zFVKKpLqKHP9r5QC6swXN4lCshRFKEaez0VX+ezLzqt2FclxURsFsxloJErH53mDarTVIwL8CAGN12Jhm8IM4+ulJ9qvtR4a8U0zmHHzlgf5C4t9XwPRaPVLxOGBLa87c9cmszx4abtns6Y4+YdHfd0GUQo/ql3fHUtQFhgz8K32kgxjoHFpso1FeGVNtbPbw8ScxP+PcUPAYwmRqpZ1P6nNmhhh7/SnBXtJJxHPu6HgcV/jhdlE/hX/wekpPrYSfJ4olw9Znuacal5awbodeu35En9IK3N2LjgXDsiMIejBMIcwGBbuic5Kke41+ohWySjB0NiqfeRgphZOuxw9DLRXilhXiqH8LK71Slvs/pH+eWj/BvDyEezsVEDxTikNJaYU6lXITUQuM7QPrAm+sAoct/D/tcMVVqYdfZTRDrQF7bv7VOwLeVjLYIj+og9A20FVhaaU= kenny.rasschaert
#!/bin/bash
if [[ "$EUID" -ne 0 ]]; then
echo "ERROR: Please run this script as root." >&2
exit 1
fi
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
# Get latest metadata from mirrors.
#!/bin/bash
# This script wraps around ssmtp. It makes a bit easier for me to send emails from cron.
# How to use this script:
# send-email.sh --subject="hello world" --body_file="/path/to/file.txt" --email="[email protected]"
# Set PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
function fail() {
@rasschaert
rasschaert / !renew-certificate.sh
Last active October 22, 2024 11:48
Automatic renewal of let's encrypt certificates using docker containers and luadns
#!/bin/bash
# Set PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# Run the certbot container to renew the certs
docker-compose -f /opt/docker/certbot/docker-compose.yml run --rm certbot
# Concatenate the resulting certificate chain and the private key and write it to HAProxy's certificate file.
cat /opt/docker/certbot/certbot/etc/letsencrypt/live/example.org/{fullchain,privkey}.pem > /opt/docker/haproxy/ssl/example_org.pem
@rasschaert
rasschaert / id_rsa.pub
Last active May 11, 2018 08:52
SSH public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC19TqKl998IFqVt6RP4mTsVTX0qP95yBUnbX1/Cfm33YgPulRyju3Q0tfajTi47yvKgTgniLoFpev4YySGiXBZ0NECCLITISoarakcqITBiY73R+F+aaw0mHx6FM9mQSAvqmEP/Vvg6UGiSUMDKxfKZPhzlbzaJO0ch00RyVgfW8CfHkL0PeUA2qFFb24nvcnqmhNeVGer0ze/NsndnvztgOp01ql6PnEES4589AgQ7y3AgwOIHz8YGr+EdAQzSsglt3cxco1wj8k7JRB+I6uIb3pcV0Y8R6kTYqdJD7QmkqOMzWZNsy+rHBzLrudZ1Wu/7eP8JBbMuVVs+5i8gU93 kenny 20180423
@rasschaert
rasschaert / live_docker_health_check.sh
Created April 9, 2018 10:06
Live Docker health check
# If you have a healthcheck defined in your Dockerfile
#
# HEALTHCHECK --interval=5s --timeout=4s --start-period=10s CMD-SHELL pg_isready -U postgres -t 0 || exit 1
#
# or in your docker-compose.yml
#
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U postgres -t 0 || exit 1"]
# timeout: 4s
# interval: 5s
@rasschaert
rasschaert / follow
Created December 1, 2015 16:31
tail -f for a web page (I use it for following Bamboo build logs)
#!/bin/bash
command="curl -s $1 2>/dev/null"
prev_output=$(eval "$command")
echo "$prev_output"
while :; do
curr_output=$(eval "$command")
curr_wc=$(echo "$curr_output" | wc -l)
prev_wc=$(echo "$prev_output" | wc -l)
wc_diff=$((curr_wc - prev_wc))
@rasschaert
rasschaert / ssh-copy-all
Created December 1, 2015 16:30
script that copies over rmate to a host and creates a wrapper called rsub
#!/bin/bash
if [[ -z $1 ]]; then
echo "Usage: $(basename $0) HOSTNAME" >&2
exit 1
fi
ssh-copy-id $@
ssh-copy-rsub $@
@rasschaert
rasschaert / dockerui.sh
Created December 1, 2015 16:28
Wrapper script that starts and stops dockerui container
#!/bin/bash
if [[ -z $1 ]]; then
echo "Usage: $(basename $0) start|stop" >&2
exit 1
fi
if [[ $1 == "start" ]]; then
echo "starting container"
docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock --name dockerui dockerui/dockerui
echo "dockerui is now listening on localhost:9000"
@rasschaert
rasschaert / arch_bootstrap.bash
Last active July 27, 2022 12:43
Shell script that performs the installation of Arch Linux the way I like it.
#!/bin/bash
bootstrapper_dialog() {
DIALOG_RESULT=$(dialog --clear --stdout --backtitle "Arch bootstrapper" --no-shadow "$@" 2>/dev/null)
}
#################
#### Welcome ####
#################
bootstrapper_dialog --title "Welcome" --msgbox "Welcome to Kenny's Arch Linux bootstrapper.\n" 6 60