Skip to content

Instantly share code, notes, and snippets.

View kernelkaribou's full-sized avatar

kernelkaribou

View GitHub Profile
@kernelkaribou
kernelkaribou / gist:2643c7847eb2589fb4b738d973c81536
Last active September 15, 2023 23:56
Technitium DNS ad blocking manager via API
#!/bin/bash
###########################################################
# Purpose: Simple script to enable and disable ad blocking
# for technitium DNS server via API calls
#
# Usage: provide either 'enable' to enable ad blocking
# or 'disable DURATION' to disable
#
# Author: kernelkaribou@github
@kernelkaribou
kernelkaribou / windows_ssh_aliases.ps
Last active June 17, 2023 15:56
Flexible script for ssh aliases in Windows
#################################################################################
# Summary:
# This basic function is for when you have multiple servers you use login
# aliases but would not like to manage adding many aliases, especially when
# consistent with minor changes, like hostname.
#
# Setup:
# This script assumes you are on Windows. Add the below function to your
# powershell profile. This can be easily edited (or created) with the
# command:
@kernelkaribou
kernelkaribou / cloudflare_ddns.sh
Created March 5, 2023 13:26
Simple bash script to update Cloudflare DNS record to represent local public IP i.e. DDNS script
#!/bin/bash
####################################################################################
# Author: Kernelkaribou@github
#
# Purpose: Update a DNS record hosted at Cloudflare to represent network public IP.
# Based upon Cloudflare API v4
#
# In cloudflare, create API key for your zone in question, e.g. example.com
# Ensuring that it has Zone Read and DNS Edit permissions. DO NOT use a Global Key
@kernelkaribou
kernelkaribou / docker_datatabase_backup.sh
Last active June 19, 2022 20:03
Backup of all postgres and mariadb docker containers using native dump methods
#!/bin/bash
######################################################################
# Bash script for backing up varying docker database containers
#
# This will search for containers using common database image names
# Currently supports postgrest and mariadb
# This uses the common pg_dump and mysqldump methods of backup
# It will also gzip the results if the -c flag is passed
# Note: This is built with linuxserver MariaDB container but should
@kernelkaribou
kernelkaribou / pihole_sync.sh
Last active June 17, 2022 18:32
Pihole Instance Sync
#!/bin/bash
######################################################################
# Bash script for syncing pihole servers to a secondary
#
# This tool will allow you sync common pihole settings, either
# full server (DNS Records and Gravity DB for adlists) or select
# specific syncs to perform. It does NOT sync the core config settings
# of the instance found in setupVars.conf
#
@kernelkaribou
kernelkaribou / cloudflare_dyndns_synology
Last active May 14, 2024 21:31
Used to regularly update a Cloudflare DNS record from your Synology NAS.
#!/bin/bash
####################################################################################
# Author: Kernelkaribou@github
#
# Purpose: Update a DNS record hosted at Cloudflare to represent network public IP.
# Based upon Cloudflare API v4
#
# Additional Notes: This will send notifications to Synology log center.
# Comment out writeLog lines if not desired or on Synology platform
@kernelkaribou
kernelkaribou / run_interval_script.sh
Last active September 2, 2017 18:39
QuickScriptRepeater
#!/bin/bash
SCRIPT_CMD="/bin/bash ./my_script.sh"
TOTAL_RUNS=2
SLEEP_TIME=30
let SLEEP_COUNTER=TOTAL_RUNS-1
COUNTER=0
while [ $COUNTER -lt $TOTAL_RUNS ]; do
eval $SCRIPT_CMD
@kernelkaribou
kernelkaribou / datatype.py
Last active August 31, 2017 17:28 — forked from cbattlegear/bandwidth.py
Quick Bandwidth Format function
#Formatting of data sent in bytes to label in largest size
def format_data_type(i, type):
loop = 0
current_num = i
last_num = 0
if type == "net":
label = ["Bps", "KBps", "MBps", "GBps"]
if type == "size":
label = ["B", "KB", "MB", "GB", "TB"]
while(True):