Skip to content

Instantly share code, notes, and snippets.

View mbierman's full-sized avatar

Michael Bierman mbierman

View GitHub Profile
@mbierman
mbierman / backup_msp_rules_new.sh
Created October 16, 2026 20:10
This can be used with Firewalla MSP to extract all rules. It is not supported by Firewalla in any way. Use at your own risk, etc. - Documentation: https://docs.firewalla.net/ - Examples on GitHub: https://github.com/firewalla/msp-api-examples
# !/bin/bash
version="2.0.1"
MSP="" # The first part of the MSP URL do not include "firewalla.net"
token="" # The MSP token
backuppath="" # The base path to save the rules
default_gid="" # set to your box GID
# --- Assumes MSP, token, backuppath, version and default_gid are defined above ---
# Global variables to hold the fetched JSON data
@mbierman
mbierman / backup_msp_rules_new.sh
Created October 16, 2026 20:09
This can be used with Firewalla MSP to extract all rules. It is not supported by Firewalla in any way. Use at your own risk, etc.
# !/bin/bash
version="2.0.1"
MSP="" # The first part of the MSP URL do not include "firewalla.net"
token="" # The MSP token
backuppath="" # The base path to save the rules
default_gid="" # set to your box GID
# --- Assumes MSP, token, backuppath, version and default_gid are defined above ---
# Global variables to hold the fetched JSON data
@mbierman
mbierman / WiF
Created November 17, 2025 20:50
Wi-Fi Calling Target list for Firewalla
*.att.net,udp:500,udp:4500
wo.vzwwo.com,udp:500,udp:4500
*.t-Mobile.com,udp:500,udp:4500
*.t-Mobile.com:5061
epdg.epc.gci.google.com,udp:500,udp:4500
@mbierman
mbierman / shutdown.sh
Last active May 1, 2025 10:14
a macOS shutdown script
#!/bin/bash
shutdown_now () {
logger "UPS Script: Sending IFTTT power_off event."
if ! curl -s -X POST https://maker.ifttt.com/trigger/...; then
logger "UPS Script: IFTTT notification failed."
fi
sleep 4
#!/usr/bin/env bash
zoneID="your_zone_ID"
ID="your_ID"
APIToken="your_API_token"
name="your_domain"
DIRECTORY=/data/logs
log="$DIRECTORY/updateIP.log"
echo $log
@mbierman
mbierman / findbig.sh
Created June 29, 2024 08:04
Finds files larger than 6 megabytes starting at $1
#!/bin/bash
if [ -z "$1" ]; then
echo "Specify which directory you want to check."
i exit
else
echo "Checking \$1 ... "
fi
sudo find "$1" -type f -size +6M -exec ls -lh {} \;
#!/bin/bash
#v 1.0.2
URL=$1
# Function to get the description for the certificate result
get_certificate_description() {
case $certificate_result in
0) echo "The certificate verification was successful." ;;
1) echo "The certificate could not be found." ;;
@mbierman
mbierman / mount_usb.sh
Last active September 26, 2023 17:56
Mount/unmount USB on Firewalla
#!/bin/bash
# V 1.0
# Copyright Michael Bierman
# https://gist.github.com/mbierman/85c9672d212bdda09d9d4f5d27574d1f
mount_point=/mnt/usb-stick/
mounted=$(mount -l | grep -c "/mnt/usb-stick")
if [ "$1" = "u" ] && [ "$mounted" -eq "1" ] ; then
read -p "Want to Unmount the drive. Please press 'Y' to continue or any key to stop: " -n1 now
@mbierman
mbierman / batcheck.sh
Last active July 7, 2023 21:41
Checks battery level for Magic Mouse, Magic Trackpad and Magic Keyboard on macOS.
#!/bin/bash
# Script that checks the battery level of connected Magic Keyboard, Magic Trackpad, and Magic Mouse and displays a notification if it is below a threshold (default 15%).
# Optionally set threshold as a parameter. ex: ./check_kb_battery.sh 10
COMPARE=${1:-15}
check_battery_level() {
device_name=$1
battery_level=$2
#!/bin/bash
diskusage=$(df -H | grep -vE '^Filesystem|mmcblk0p3' | awk '{ print $6 }')
name=$(printf "$(redis-cli get groupName)")
log=/data/logs/fwcheckspace.log
mydate=$(date +"%a %b %d %H:%M %P")
dir=$(dirname "$0")
IFTTTKEY="$(cat $dir/IFTTT.data | grep IFTTTKEY | cut -f2 -d "=" )"
IFTTTrigger="FWGReboot"
IMAGE="https://avatars2.githubusercontent.com/u/21322342?s=200&v=4"
URL="firewalla://" # opens the firewalla app on iOS