Skip to content

Instantly share code, notes, and snippets.

@dev01d
dev01d / docker.sh
Created October 2, 2022 04:46
Set up Docker
#!/usr/bin/env bash
#
######* Install and setup Docker ######
if [ ! -f /usr/bin/docker ] || [ ! -f /usr/libexec/docker/cli-plugins/docker-compose ]; then
sudo apt-get remove docker docker-engine docker.io containerd runc
#
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
#
echo \
@dev01d
dev01d / Makefile
Last active April 7, 2022 22:29
Docker compose makefile
.PHONY: start down destroy stop pull restart logs
.DEFAULT_GOAL := restart
start:
docker compose up -d --remove-orphans $(c)
down:
docker compose down $(c)
destroy:
@dev01d
dev01d / .env
Last active March 4, 2023 14:20
System-wide Traefik Reverse Proxy
EMAIL=
DOMAIN0=
DOMAIN1=
API_EMAIL=
API_TOKEN=
@dev01d
dev01d / y-n.sh
Created August 16, 2021 11:53
y/n
#!/usr/bin/env bash
read -p "Question (y/N)? " answer
case ${answer:-n} in
y|Y )
echo Yes
;;
n|* )
echo No
;;
@dev01d
dev01d / raid_alert.sh
Created May 25, 2020 08:32
Slack RAID notification
#!/bin/bash
#* Vars
CONTROLLER=*controller*
USERNAME=RAID
STATUS=`sudo tw_cli info "$CONTROLLER" | grep "RAID"`
OK=`echo "$STATUS" | grep "OK"`
HOOK_URL=https://hooks.slack.com/services/****/****/****
#
function slackNotify() {
curl -X POST -H 'Content-type: application/json' --data '{"username": "'$USERNAME'", "attachments": [{"color": "'$COLOR'", "text": "```'"$MESSAGE"'```"}]}' "$HOOK_URL"
@dev01d
dev01d / piBak.sh
Last active August 16, 2021 11:43
Raspberry Pi SD card backup
#!/usr/bin/env bash
#Sudo check
if (( $EUID != 0 )); then
echo -e "\nPlease run as root or use sudo\n"
exit
fi
# OS checks
arch=$(uname -s)
@dev01d
dev01d / vscode-italics.json
Last active March 30, 2024 19:19
VSCode italics in (almost) any theme
// All you need to do is add a font that has pretty good itlaics support i.e Fira, Operator, etc. and then add these two params to your existing User settings.
{
"editor.fontFamily": "'Operator Mono', Menlo, Monaco, 'Courier New', monospace",
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"comment",
"keyword.control",
@dev01d
dev01d / to_hevc.sh
Last active November 14, 2018 04:25
This script automatically converts a directory of video files to H.265 HEVC with HandBrake and deletes the old files.
#!/bin/bash
#
# This script automatically converts a directory of video files to H.265 HEVC with HandBrake and deletes the old files.
#
if [ -z "$1" ]; then
SRC="."
else
SRC="$HOME/$1"
fi
find "$SRC" -iregex '.*\.\(mkv\|avi\)$' -exec bash -c 'HandBrakeCLI -i "$1" -o "${1%\.*}".mp4 -e x265 -q 22 -E av_aac --custom-anamorphic --keep-display-aspect' __ {} \; && find "$SRC" -iregex '.*\.\(mkv\|avi\)$' -exec rm -r {} \;
@dev01d
dev01d / fixperms.sh
Last active November 9, 2023 00:27
Fix all directory and file permissions (even dot files).
#!/usr/bin/env bash
#
##
### Fix file pemissions
### dirs 755 files 644
##
#
CWD="$(pwd)"
@dev01d
dev01d / mailQueue.sh
Last active September 23, 2018 21:20
A script for monitoring Exim undelivered mail queue.
#!/usr/bin/env bash
#
# A script for monitoring Exim undelivered mail queue.
# intended to be used in conjunction with a cron job.
#
# Email recipient
alertEmail=#Add email here.
# Set the alert threshold here
queueThreshold=100