Skip to content

Instantly share code, notes, and snippets.

View mbierman's full-sized avatar

Michael Bierman mbierman

View GitHub Profile
@mbierman
mbierman / fw_reboot.sh
Last active February 17, 2023 06:35
Firewalla script to log upgrades and reboots and notify you.
#!/bin/bash
# v 1.2.2
dir=$(dirname "$0")
IFTTTKEY="$(cat $dir/rebootdata.txt | grep IFTTTKEY | cut -f2 -d "=" )"
IFTTTrigger="$(cat $dir/rebootdata.txt | grep IFTTTTrigger | cut -f2 -d "=" )"
version=$(cat ~/firewalla/net2/config.json | jq '.version')
version=${version:=Not Found}
OS=$(lsb_release -r | cut -f2)
build=$(grep -a "FIREWALLA.UPGRADECHECK.CHECK" /log/firewalla/firelog.log | tail -1 | cut -f12 -d" " | cut -c 1-8)
sleep-with-countdown() {
secs=$1
while [ $secs -gt 0 ]; do
printf "\rsleep: $secs\033[0K"
sleep 1
: $((secs--))
done
printf "\n"
}
@mbierman
mbierman / getnpr.sh
Last active April 10, 2021 01:49
Fetch NPR shows
#!/bin/bash
# Varibles
OS="$(uname -s | sed -e 's/Darwin/macos/g')"
MUSER=$(echo $USER | tr '[:upper:]' '[:lower:]' | awk '{for (i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) substr($i,2)} 1')
MACH=$(hostname -s)
PATH=$LOCATION:$PATH
UA="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36"
MKDIR="mkdir -p"
LOCATION=$(dirname $0)
@mbierman
mbierman / gist:3232063
Created August 2, 2012 00:57
AppleScript to preview the current file in TextWranger in Chrome.
-- Based on Sam Dutton's script (http://goo.gl/27XlZ)
-- which was based on Mike Piontek's script (http://goo.gl/SBkkL)
-- This is Chrome specific. See https://gist.github.com/3232318 for a Safari Script
tell application "TextWrangler" to set theFile to file of document 1
tell application "TextWrangler" to save document 1
set appleScriptPath to theFile as text
set currentURL to POSIX path of appleScriptPath
set currentURL1 to POSIX path of appleScriptPath
@mbierman
mbierman / apigeeconsole.html
Created May 3, 2012 08:33
How to make an embedded Apigee console for API documentation
<iframe src="https://apigee.com/embed/console/twitter?v=2" height="100%" width="100%" scrolling="no"></iframe>
<!--
How to make an embedded Apigee API v2 Console
Simply go to https://apigee.com/togo and create a console. Then, you'll get an iframe code similar to the one above with your Console and you can embed anywhere you like.
The "?v=2" is a new way to get the latest Apigee Console. More details to come!
-->