Skip to content

Instantly share code, notes, and snippets.

View mbierman's full-sized avatar

Michael Bierman mbierman

View GitHub Profile
#!/bin/bash
echo "Making windows movable by CTRL-⌘"
defaults write -g NSWindowShouldDragOnGesture -bool true
# The dock on your Mac can sometimes feel too crowded. One way to fix that is by hiding all inactive apps from the dock. You can do this with a simple Terminal command.
echo "cleaning dock"
defaults write com.apple.dock static-only -bool true; killall Dock
# Add an option that lets you quit the app (which means relaunch in the case of Finder) from the menu bar. Use this command to get the job done:
@mbierman
mbierman / Readme.txt
Last active December 8, 2023 15:11
start homebridge on Fireawlla
Save this to ~/.firewalla/config/post_main.d inorder to make sure homebridge restarts automatically every time Firewalla does. That directory may not exist so just create it if that's the case.
@mbierman
mbierman / runlike.sh
Created April 14, 2022 21:51
get docker running instructions
#!/bin/bash
# https://hub.docker.com/r/assaflavie/runlike/
if [ $1 ] ; then
sudo docker run -v /var/run/docker.sock:/var/run/docker.sock assaflavie/runlike $1
else
echo -e "\nYou must specify a docker container that is running, like so: \n\n $0 homebridge\n "
exit
@mbierman
mbierman / resetdocker.sh
Created April 12, 2022 19:35
Reset Dockers on Firewalla
#!/bin/bash
echo Running installer
read -p "Do you want to continue? (y|n) ? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
sudo su -
systemctl stop docker-compose@*
systemctl stop docker
cd /var/lib/docker/
@mbierman
mbierman / acraCleanup.js
Last active April 14, 2022 23:52
Keep Google Sheet under a fixed number of rows.
function acraCleanup() {
var rowsToKeep = 1996; // CHANGE TO YOUR DESIRED NUMBER OF ROWS TO KEEP.
var rows = SpreadsheetApp.getActiveSheet().getLastRow();
var numToDelete = rows - rowsToKeep -1;
if ( numToDelete >= 1 ) {
SpreadsheetApp.getActiveSheet().deleteRows(2, numToDelete);
}
}
@mbierman
mbierman / addremotesyslog.sh
Last active May 14, 2026 04:43
Add a remote syslog server to Firewalla
#!/bin/bash
# v 2.1.0
syslog=/etc/rsyslog.d/09-externalserver.conf
# this logs notice and above. use *.* log everything.
filter=*.notice
server=192.168.0.19 # Change the server to the IP of your syslog server.
port=514
hostname=firewalla
valid=$(grep "$server:$port" $syslog 2>/dev/null)
@mbierman
mbierman / porttest.sh
Created March 9, 2022 21:12
See if there is a TCP port open at an IP
#!/bin/bash
ip=$1
port=$2
# port=${2:-5001}
if [[ $ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $port =~ ^[0-9]* ]] ; then
nc -vnz $ip $port
exit
else
echo -e "Sorry you have to enter an IP and port?\n\n $(basename $0) [xxx.xxx.xxx.xxx port]"
@mbierman
mbierman / install_iftop.sh
Created February 17, 2022 23:13
Install iftop on Firewalla
#!/bin/bash
app=iftop
command_exists () {
command -v $1 >/dev/null 2>&1;
}
if command_exists $app; then
echo -e "\n\n$app instaleld!\n bye"
@mbierman
mbierman / install_htop.sh
Last active August 11, 2022 02:23
Install htop on Firewalla
#!/bin/bash
# 2.1
# https://gist.github.com/mbierman/561643e89e98137ea5f11f02a0f3ccd2
# Put this script in ~/.firewalla/config/post_main.d in order to resinstall after upgrades
log=/data/fw_reboot.txt
if ! [ -w $log ] ; then
sudo touch $log
sudo chmod a+w $log
@mbierman
mbierman / startup.sh (FWG)
Created January 21, 2022 21:00
Homebridge startup scripts for my Synology and Firewalla to install necessary packages
#!/bin/sh
#
# Docker Homebridge Custom Startup Script - oznu/homebridge
#
# This script can be used to customise the environment and will be executed as
# the root user each time the container starts.
#
# If using this to install plugins DO NOT use the global flag (-g).
#