Skip to content

Instantly share code, notes, and snippets.

View mbierman's full-sized avatar

Michael Bierman mbierman

View GitHub Profile
@mbierman
mbierman / epocdate.sh
Last active September 8, 2022 00:09
Gets epoc dates for some number of minutes and hours you select before now. Mostly created for plaing with Firewalla MSP API
#!/bin/bash
# v 1.0.1
# https://gist.github.com/mbierman/f81b591fd27638b9f4221e9525229eca
echo -e "How many minutes before now?"
read minutes
# min=$(date -v-${minutes}M +%s)
minutes=${minutes:=0}
echo -e "You entered $minutes minutes\n\n"
@mbierman
mbierman / randommac.sh
Last active February 9, 2026 04:36
NOTE: Looks like Apple killed tis in Sonoma for Ethernet but the following works for Wi-Fi.
#!/bin/bash
# v 2.0
# https://gist.github.com/mbierman/03b2a962ac04963ef5bbc8354d0ed5d1
# 2022 mbierman
sleep="${1:-6}"
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