Skip to content

Instantly share code, notes, and snippets.

View mbierman's full-sized avatar

Michael Bierman mbierman

View GitHub Profile
@mbierman
mbierman / fw_start.sh
Last active August 11, 2022 02:19
Firewalla start script This is a script to use with Firewalla Gold to start a docker image and disable ping upon reboot.
#!/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 April 7, 2025 12:34
Restart Homebridge
#!/bin/bash
# v 2.7
# https://gist.github.com/mbierman/dd45821b53d5d22147cef217f0c0fe95
# Variables
update="false"
reboot="false"
hostname=$(hostname)
docker="/.dockerenv"
@mbierman
mbierman / cleanconfig.sh
Created June 11, 2020 17:09
This script cleans the 'config.js' for homebridge so you can share it for debugging purposes.
#!/usr/bin/env sh
cat config.json | sed \
-e 's|"username.*|"username":"*****",|g' \
-e 's|"pin.*|"pin": "*****"|g' \
-e 's|"IFTTTkey.*|"IFTTTkey:"*****",|g' \
-e 's|"IFTTTservice.*|"IFTTTservice: "*****",|g' \
-e 's|"ip": "192.*|"ip": "*****",|g' \
-e 's|"mac.*|"mac": "*****",|g' \
@mbierman
mbierman / tabliss.css
Last active June 10, 2020 22:57
My favorite customizations of https://tabliss.io/
@import url('https://fonts.googleapis.com/css2?family=Muli:wght@700&display=swap');
.plane, div.Settings {
color: black;
z-index:100;
}
.Time, .Weather, .Greeting {
color: white;
text-shadow:3px 3px 18px black;
@mbierman
mbierman / iOSBackup.applescript
Last active January 5, 2021 10:03
Backup iOS devices
tell application "System Events" to tell application process "Finder"
set frontmost to true
choose from list {"Michael’s iPhone", "Michael’s iPad"} with title "What devices do you want to backup?" with multiple selections allowed
set devices to result
repeat with device in devices
-- display alert "looking for: " & device
set notificationTitle to "iOS Backup"
set notificationSubTitle to "Looking for"
@mbierman
mbierman / homebridge.sh
Last active August 11, 2022 02:09
Gets an auth token and then lists the plugins you have installed and all the information about them. Can be used for any homebridge UI API call.
#!/bin/sh
# token=$(curl -s -X POST "http://pigpen.lan:8581/api/auth/login" -H "accept: */*" -H "Content-Type: application/json" -d '{"username":"admin","password":"^","otp":"string"}' | jq '.access_token' |
token=$(curl -s -X POST "http://pigpen.lan:8581/api/auth/login" -H "accept: */*" -H "Content-Type: application/json" -d '{"username":"admin","password":"","otp":"string"}' | grep -e 'access_token'
basedir=/homebridge/plugins/plugins_
today=$basedir$(date "+%m.%d.%Y").txt
@mbierman
mbierman / neurio.sh
Last active May 20, 2020 20:44
Get your current power usage from your Neurio/PWRview monitor
#!/usr/bin/env bash
BASEDIR=$(dirname "$0")
APIKEY="$(cat $BASEDIR/neuriodata.txt | grep API | cut -f2 -d "=" )"
POWER=$(curl -s -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Basic $APIKEY=" -H 'Pragma: no-cache' http://neurio.lan/current-sample | jq '.channels[1].p_W')
echo -e "Your home is currently using: $POWER w \n\n"
@mbierman
mbierman / brewme.sh
Last active September 10, 2020 18:40
#!/usr/bin/env bash
echo -e $(date) - "Start" >> /tmp/local.brew.out
echo "updating brew..."
brew update
echo "outdated brew..."
brew outdated
echo "upgrading brew..."
brew upgrade --cask
echo "cleaning up brew..."
@mbierman
mbierman / updatenoip.sh
Created April 7, 2020 01:47
Update no IP address
#!/bin/bash
###############################################################
## ChangeIP.com bash update script
###############################################################
## Written 3/18/09 by Tom Rinker, released to the Public Domain
## Re-write 09/15/2017 by Michael Bierman
## I replaced wget with curl so it can work on all macs.
## This works with no-ip.com
###############################################################
@mbierman
mbierman / Archive.js
Last active September 6, 2019 23:26
Archive a row in a spreadsheet
function myArchive(){
Logger.log("Archieving...");
// moves a row from a sheet to another when a magic value is entered in a column
// adjust the following variables to fit your needs
// see https://productforums.google.com/d/topic/docs/ehoCZjFPBao/discussion
var target = 'Data';