Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Bierman mbierman

View GitHub Profile
@mbierman
mbierman / logspeed.sh
Last active Oct 18, 2021
Log speedtest results on Firewalla
View logspeed.sh
#!/bin/bash
# v 0.18
# IFTTTKEY=adsfadsfkdsf
BASEDIR=$(dirname $0)
IFTTTKEY="$(cat $BASEDIR/IFTTT.data | grep IFTTTKEY| cut -f2 -d "=" )"
EVENT="FWspeedtest"
# set to false if you don't want to log speed to a google Spreadsheet
@mbierman
mbierman / exifRename.sh
Last active Aug 29, 2021
exifRename.sh
View exifRename.sh
#!/bin/bash
# requires:
# * https://formulae.brew.sh/formula/jq#default
# * https://formulae.brew.sh/formula/exiftool#default
for file in "$@"
do
date=$(exiftool -json "$file" | jq '.[] .CreateDate' | sed -e 's| |_|g' -e 's|:|.|g' -e 's|"||g')
View fwg_reboot.sh
#!/bin/bash
dir=$(dirname "$0")
IFTTTKEY="$(cat $dir/rebootdata.txt | grep IFTTTKEY | cut -f2 -d "=" )"
IFTTTrigger="$(cat $dir/rebootdata.txt | grep IFTTTTrigger | cut -f2 -d "=" )"
echo $IFTTTrigger
IMAGE="https://avatars2.githubusercontent.com/u/21322342?s=200&v=4"
URL="firewalla://"
PACKAGE="Firewalla Gold reboot"
@mbierman
mbierman / fwg_reboot_notifications.sh
Last active Aug 24, 2021
Firewalla reboot notification via IFTT
View fwg_reboot_notifications.sh
#!/bin/bash
dir=$(dirname "$0")
IFTTTKEY="$(cat $dir/rebootdata.txt | grep IFTTTKEY | cut -f2 -d "=" )"
IFTTTrigger="$(cat $dir/rebootdata.txt | grep IFTTTTrigger | cut -f2 -d "=" )"
echo $IFTTTrigger
ONLINE=1
while [ $ONLINE -ne 0 ]
do
@mbierman
mbierman / lights.sh
Last active Apr 10, 2021
Turn on/off lights on Unifi APs
View lights.sh
#!/bin/bash
# Variables
result=""
count=0
log=/data/logs/lights.log
private=/home/pi/.firewalla/config/post_main.d/pass.txt
dir=$(dirname "$0")
user=$(cat $dir/lights.txt | grep user | cut -f2 -d "=" )
baseIP=192.168.0
@mbierman
mbierman / updatedocker.sh
Last active Sep 17, 2021
Update Docker containers
View updatedocker.sh
!/bin/bash
DOCKER=$(which docker)
wait=60
image=$1
if [ "$1" = "homebridge" ]; then
container="oznu/homebridge:latest"
elif [ "$1" = "docker-notify" ]; then
@mbierman
mbierman / install_speedtest.sh
Last active Sep 6, 2021
Install Speedtest for firewalla
View install_speedtest.sh
#!/bin/bash
installcheck=$(which speedtest)
echo $installcheck
if [ -n "$installcheck" ] ; then
echo -e "\n\nspeedcheck instaleld!\n bye"
exit
fi
list=$(/etc/apt/sources.list.d/speedtest.list)
@mbierman
mbierman / updateIPCloudflare.sh
Last active Jun 15, 2021
DDNS update for Cloudflare with dual WAN support
View updateIPCloudflare.sh
#!/usr/bin/env bash
zoneID=""
ID=""
APIToken="-"
name="."
days=2020
result=""
# */5 * * * * /home/pi/.firewalla/config/post_main.d/updateIPCloudflare.sh >/dev/null 2>&1walla" ]; then
@mbierman
mbierman / fw_start.sh
Last active Sep 22, 2020
Firewalla start script This is a script to use with Firewalla Gold to start a docker image and disable ping upon reboot.
View fw_start.sh
#!/bin/bash
dockerid=""
# disable ping
sudo iptables -A FW_INPUT_DROP -i $(frcc | jq -r '.routing.global.default.viaIntf') -p icmp -j FW_DROP
# start docker
cd /homebridge
sudo systemctl enable docker
sudo docker start $dockerid
@mbierman
mbierman / reboot.sh
Last active Jul 28, 2021
Restart Homebridge
View reboot.sh
#!/bin/sh
# Variables
update="false"
reboot="false"
hostname=$(hostname)
docker="/.dockerenv"
dir=$(dirname "$0")
IFTTTKEY="$(cat $dir/rebootdata.txt | grep IFTTTKEY | cut -f2 -d "=" )"
IFTTTrigger="$(cat $dir/rebootdata.txt | grep fpass | cut -f2 -d "=" )"