Skip to content

Instantly share code, notes, and snippets.

View mbierman's full-sized avatar

Michael Bierman mbierman

View GitHub Profile
@mbierman
mbierman / randommac.sh
Last active June 18, 2024 09:52
NOTE: Looks like Apple killed tis in Sonoma. There may be no viable workaround. If I find one, I will update this script. This allows you to create and assign any MAC address you like for macOS Wi-Fi or Ethernet connections. If you don’t supply one a random mac will be created for you.
#!/bin/bash
# v 1.0.2
# https://gist.github.com/mbierman/03b2a962ac04963ef5bbc8354d0ed5d1
# 2022 mbierman
sleep="${1:-5}"
regex="^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$"
getmac () {
rnd=$(openssl rand -hex 6 | sed 's/\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)/\1:\2:\3:\4:\5:\6/')
@mbierman
mbierman / backup.sh
Last active August 2, 2022 08:39
pihole stuff
#!/bin/bash
retain=30
# This script will create a Teleport backup to a directory that it is run in.
# Change to mapped directory
cd /home/ubuntu/backups
# Run Backup
pihole -a -t &
# Record the process id and wait
@mbierman
mbierman / install_FWUtilities.sh
Last active April 12, 2023 16:27
installation of various tools on Firewalla
#!/bin/bash
# v 1.01
# https://gist.githubusercontent.com/mbierman/ced69a41181637995f61323e7ac97cba/raw/214028a0430b5a54788ca727849aca84f0aed594/install_FWToys.sh
dir="/home/pi/.firewalla/config/post_main.d/"
app="install_sshpass.sh"
cd $dir
@mbierman
mbierman / install_iftop.sh
Last active August 11, 2022 02:25
Install iftop on Firewalla
#!/bin/bash
# v2.0
# https://gist.github.com/mbierman/dd9fd1b89220af98dea74b2ab95a9f15
# 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 / install_sshpass.sh
Last active August 11, 2022 02:24
install sshpass. on Firewalla
#!/bin/bash
# v 2.0
# https://gist.github.com/mbierman/362193a8cfaf14361945c27c48692d50
# Put this script in ~/.firewalla/config/post_main.d in order to resinstall after upgrades
log=/data/fw_reboot.txt
app=sshpass
edate=$(date +'%a %b %d %H:%M:%S %Z %Y')
@mbierman
mbierman / Pi Cron
Created July 29, 2022 05:53
Update pi-hole
9 3 * * mon,wed,fri root echo $(date) > /var/log/pihole_updateGravity.log && /usr/local/bin/pihole updateGravity | tee -a /var/log/pihole_updateGravity.log
@mbierman
mbierman / config_dnsmasq.sh
Created July 7, 2022 01:11
config_dnsmasq.sh
#!/bin/bash
reboot=false
if [ ! -f ~/.firewalla/config/dnsmasq_local/staylocal ] ; then
echo -e "local=/lan/127.0.0.2\nlocal=/local/127.0.0.2\nlocal=/lan22/127.0.0.2\nlocal=/lan33/127.0.0.2\nlocal=/lan44/127.0.0.2\nlocal=/lan55/127.0.0.2\nlocal=/lan66/127.0.0.2\nlocal=/gst/127.0.0.2" > ~/.firewalla/config/dnsmasq_local/staylocal
echo dnsmasq: staylocal configured
reboot=true
else
echo dnsmasq: staylocal exists, nothing to do
@mbierman
mbierman / dnsspeedest.sh
Created May 31, 2022 08:41
test the speed of DNS servers
#!/bin/bash
target="${1:-google.com}"
echo testing $target
main()
{
# Enter the DNS providers you want to test
hosts='[
{
@mbierman
mbierman / install lm_sensors.sh
Last active June 16, 2024 06:02
install sensors on Firewalla
#!/bin/bash
# v 2.0
# https://gist.github.com/mbierman/bc6b9f11c82f6fd7efdafac269fb058d
# 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
#!/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: