Skip to content

Instantly share code, notes, and snippets.

View Nebucatnetzer's full-sized avatar

Andreas Zweili Nebucatnetzer

View GitHub Profile
@Nebucatnetzer
Nebucatnetzer / dev.sh
Last active July 22, 2023 16:32
A BASH script which acts as a simple task runner like Just or abused Makefiles.
#!/usr/bin/env bash
# This script allows you to run tasks with `dev.sh TASKNAME`.
# Create a function and assign the function to a desired argument.
# For example the function `run` can be executed with:
# `dev.sh run` or `dev.sh start`
# If no argument is provided it will show the available options and their
# description.
declare -A tasks
@Nebucatnetzer
Nebucatnetzer / update_namecheap.sh
Created September 20, 2022 17:39
Update namecheap host entries via their API.
#/usr/bin/env bash
declare -A domains
domains['DOMAIN']='key'
domains['DOMAIN']='key'
domains['DOMAIN']='key'
domains['DOMAIN']='key'
rm /var/log/fancy_namecheap.txt
@Nebucatnetzer
Nebucatnetzer / reboot_if_offline.sh
Last active September 21, 2022 06:28
A simple script to reboot my IPFire box if the internet isn't reachable for 45 minutes. Goes to /etc/fcron.cyclic/
#!/usr/bin/env bash
reboot_index=$(($(</var/run/reboot_index)))
reset-index(){
echo 0 > /var/run/reboot_index
echo "$(date +'%Y-%m-%dT%H:%M:%S%z'): $1" >> /var/log/reboot_if_offline.log
}
if [ "$(find /var/run/reboot_index -mmin +1)" != "" ] && [ $reboot_index != 0 ]; then