Skip to content

Instantly share code, notes, and snippets.

View send-email.sh
#!/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="kenny@example.com"
# Set PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
function fail() {
@rasschaert
rasschaert / !renew-certificate.sh
Last active Apr 23, 2020
Automatic renewal of let's encrypt certificates using docker containers and luadns
View !renew-certificate.sh
#!/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
SSH public key
View id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC19TqKl998IFqVt6RP4mTsVTX0qP95yBUnbX1/Cfm33YgPulRyju3Q0tfajTi47yvKgTgniLoFpev4YySGiXBZ0NECCLITISoarakcqITBiY73R+F+aaw0mHx6FM9mQSAvqmEP/Vvg6UGiSUMDKxfKZPhzlbzaJO0ch00RyVgfW8CfHkL0PeUA2qFFb24nvcnqmhNeVGer0ze/NsndnvztgOp01ql6PnEES4589AgQ7y3AgwOIHz8YGr+EdAQzSsglt3cxco1wj8k7JRB+I6uIb3pcV0Y8R6kTYqdJD7QmkqOMzWZNsy+rHBzLrudZ1Wu/7eP8JBbMuVVs+5i8gU93 kenny 20180423
View live_docker_health_check.sh
# 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 Dec 1, 2015
tail -f for a web page (I use it for following Bamboo build logs)
View follow
#!/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 Dec 1, 2015
script that copies over rmate to a host and creates a wrapper called rsub
View ssh-copy-all
#!/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 Dec 1, 2015
Wrapper script that starts and stops dockerui container
View dockerui.sh
#!/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 Nov 21, 2020
Shell script that performs the installation of Arch Linux the way I like it.
View arch_bootstrap.bash
#!/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
@rasschaert
rasschaert / eclipse-4.4.1-to-deb.sh
Created Oct 12, 2014
Eclipse 4.4.1 packaging script
View eclipse-4.4.1-to-deb.sh
#!/bin/bash
echo "Creating directory structure"
mkdir -p ./tmproot/usr/local/bin
mkdir -p ./tmproot/usr/share/applications
mkdir -p ./tmproot/usr/share/icons/hicolor/256x256/apps
mkdir -p ./tmproot/usr/share/icons/gnome/256x256/apps
mkdir -p ./tmproot/opt/
cd ./tmproot/opt
echo "Downloading tarball"
View .config_terminator_config
[global_config]
title_transmit_fg_color = "#f2f0ec"
title_inactive_fg_color = "#2d2d2d"
title_receive_bg_color = "#6699cc"
title_transmit_bg_color = "#f2777a"
title_receive_fg_color = "#f2f0ec"
title_inactive_bg_color = "#d3d0c8"
[keybindings]
[profiles]
[[default]]