Skip to content

Instantly share code, notes, and snippets.

View luckman212's full-sized avatar

Luke Hamburg luckman212

View GitHub Profile
@luckman212
luckman212 / opentable.txt
Last active April 5, 2018 13:21
OpenTable subnets for pfSense URL alias
# OpenTable Data Center (OTDC)
199.16.146.0/24
66.151.130.0/24
66.151.149.224/27
66.151.149.32/27
# OpenTable Disaster Recovery (OTDR)
199.16.147.0/24
199.16.145.0/24
67.202.218.0/25
@luckman212
luckman212 / test1.txt
Last active May 21, 2018 19:18
test1
#a comment!
ftp.lighthousecorp.com
all.sipis.acrobits.cz
bogus.domainxxxxxxxxxxxxxxxxxxxxxxxxxxxx.dorky
some.garbage.crap
www.google.com
#2nd comment
#line without a CR...
@luckman212
luckman212 / v6test.sh
Last active October 23, 2023 02:38
script for pfSense to detect IPv6 router advertisements coming from a WAN interface
#!/bin/sh
# set the variable below to your FIOS interface
IF=igb0
/usr/bin/timeout 5m /usr/sbin/tcpdump -ni ${IF} 'icmp6 && ip6[40] == 134' >/tmp/${IF}_RAs.out
FSIZE=$(/usr/bin/stat -f '%z' /tmp/${IF}_RAs.out)
if [ "$FSIZE" -gt 1 ]; then
echo '<?php include("notices.inc"); $msg = "IPv6 RAs detected on interface '$IF'"; notify_via_smtp($msg);?>' | /usr/local/bin/php -q
fi
@luckman212
luckman212 / pkg_check.php
Last active May 16, 2024 12:54
pfSense auto-update check
<?php
require_once("pkg-utils.inc");
require_once("notices.inc");
require_once("util.inc");
$msg = null;
$pmsg = null;
$p = 0;
@luckman212
luckman212 / keybase.md
Created December 27, 2018 02:00
keybase.md

Keybase proof

I hereby claim:

  • I am luckman212 on github.
  • I am luckman212 (https://keybase.io/luckman212) on keybase.
  • I have a public key ASCKMjaZ81gUco_Qcz_g6wNVY6_TUcC77T6HcInvXYNrPQo

To claim this, I am signing this object:

@luckman212
luckman212 / cdn_fw
Created January 16, 2019 06:23
Control script to enable/disable CDN firmware updates on Unifi controller (bash)
#!/usr/bin/env bash
# must be run as root
CDN_HOSTNAME=fw-update.ubnt.com
FW_JSON=/var/lib/unifi/firmware.json
FW_BASENAME=${FW_JSON%.json}
TAB=$(printf '\t')
function check_cdn() {
if grep -Ec "^127.0.0.1[\ ${TAB}]+${CDN_HOSTNAME}$" /etc/hosts >/dev/null; then
@luckman212
luckman212 / frontapp.py
Created May 10, 2019 05:15
simple python script that prints the frontmost (aka focused) app
#!/usr/bin/python
# references
# https://developer.apple.com/documentation/appkit/nsworkspace
# https://bmn.name/post/2016/05/28/current-osx-app/
# https://stackoverflow.com/questions/28815863/how-to-get-active-window-title-using-python-in-mac
# https://apple.stackexchange.com/questions/123730/is-there-a-way-to-detect-what-program-is-stealing-focus-on-my-mac/
try:
from AppKit import NSWorkspace
@luckman212
luckman212 / hopfinder.sh
Last active January 9, 2023 10:41
hopfinder.sh - find good candidates for gateway monitoring (dpinger) in pfSense
#!/bin/sh
# hopfinder for pfSense
# finds nearby upstream targets for gateway monitoring
# gist: e5df683d8b11dd68aef3255efc22e611
list_ifs() {
/usr/local/bin/php <<EOP
<?php
require_once('interfaces.inc');
@luckman212
luckman212 / node_update.sh
Created September 18, 2019 12:07
bash script to update n, nodejs, and npm
#!/usr/bin/env bash
# requires jq - https://stedolan.github.io/jq/
function ver_highest() {
if [[ $# -lt 2 ]]; then
echo "usage: ver_highest v1 v2 [v3...]"
return 1
fi
awk -v OFS="\n" '$1=$1' <<< "$*" | sort -V | tail -n1
}
@luckman212
luckman212 / float.lua
Last active April 15, 2023 15:13
WIP of my floating window preview project for Hammerspoon
--[[ Live-updating floating windows at your service!
https://www.hammerspoon.org/docs/hs.window.html
https://www.hammerspoon.org/docs/hs.canvas.html
https://www.hammerspoon.org/docs/hs.image.html
https://www.hammerspoon.org/docs/hs.mouse.html
https://www.hammerspoon.org/docs/hs.timer.html
https://www.lua.org/manual/5.4/manual.html#6.2 (coroutines)
https://github.com/Hammerspoon/hammerspoon/issues/2710#issuecomment-788266990 (thanks @asmagill)