Skip to content

Instantly share code, notes, and snippets.

View donalod's full-sized avatar
🏠
Building PanSift so you can WFH

Donal donalod

🏠
Building PanSift so you can WFH
View GitHub Profile
@donalod
donalod / extract.sh
Last active October 18, 2023 20:26
apple80211_channel_flags_extract.sh
#!/usr/bin/env bash
# set -e
# set -x
plistbuddy="/usr/libexec/PlistBuddy"
airport_output=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s -x)
wlan_sp_airport_data_type=$(system_profiler SPAirPortDataType)
scandata=./scandata.plist
@donalod
donalod / localdns.sh
Created September 14, 2022 14:59
localdns with dnsmasq installed on macOS
#!/usr/bin/env bash
# Assumes dnsmasq is available and you have 127.0.0.1 and ::1 configured at the top of your DNS settings in
# /etc/resolv.conf
# Also assumes you have previously provided the plist as per:
# sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/
if [[ "$1" == "on" ]]; then
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
@donalod
donalod / PanSift_0.3.6_on_12.0.1_problem.log
Created November 17, 2021 18:47
PanSift_0.3.6_on_12.0.1_problem
info 18:12:38.524332+0000 Finder _LSLaunchRB(com.pansift.p3bar <private>, event=aevt/oapp, args=- 0x10040/async opts=(null)
info 18:12:38.529306+0000 Finder LAUNCH:_LSLaunchThruRunningboard: com.pansift.p3bar / <private>
info 18:12:38.531795+0000 Finder LAUNCH: Launching with process identity application.com.pansift.p3bar.9105111818.9105112056, com.pansift.p3bar <private>
info 18:12:38.532066+0000 Finder Sending launch request: <RBSLaunchRequest| app<application.com.pansift.p3bar.9105111818.9105112056(501)>; "LS launch com.pansift.p3bar">
default 18:12:38.532494+0000 runningboardd Launch request for app<application.com.pansift.p3bar.9105111818.9105112056(501)> is using uid 501 (divined from auid 501 euid 501)
default 18:12:38.532630+0000 runningboardd Acquiring assertion targeting app<application.com.pansift.p3bar.9105111818.9105112056(501)> from originator [daemon<com.apple.Finder(501)>:586] with description <RBSAssertionDescriptor| "LS launch com.pansift.p3bar" ID:166-586-254678 target:app<application.com.
@donalod
donalod / example
Last active November 10, 2021 16:33
How to tell 80MHZ from IE
# Example 1 of 2
<dict>
<key>80211D_IE</key>
<dict>
<key>IE_KEY_80211D_CHAN_INFO_ARRAY</key>
<array>
<dict>
<key>IE_KEY_80211D_FIRST_CHANNEL</key>
<integer>36</integer>
@donalod
donalod / throttle.applescript
Last active September 23, 2021 15:46
throttle.applescript
-- https://stackoverflow.com/questions/34876073/switch-network-link-conditioner-profiles-from-console-script/38991769
-- found via https://gist.github.com/cantyjeffrey/42a0d080c83c46a6f76e5705fd6d90af
set mode to system attribute "mode"
tell application "System Preferences"
activate
set current pane to pane "com.apple.Network-Link-Conditioner"
delay 1
end tell
@donalod
donalod / pansift_demo_throttle.sh
Last active November 18, 2021 15:45
pansift_demo_throttle.sh
#!/usr/bin/env bash
# This relies on the throttle.applescript
# https://gist.github.com/donalod/7c0a63df318aff3739e72f7ad9ec3854
# Run it via crontab BUT YOU MUST ALLOW CRON IN "SECURITY & PRIVACY / ACCESSIBILITY"
# * */2 * * * /Users/administrator/pansift_demo_throttle.sh >/tmp/stdout.log 2>/tmp/stderr.log
timestamp=$(date "+%Y%m%dT%H%M%S%z")
echo "Starting at $timestamp"
@donalod
donalod / algolia_list.js
Created November 2, 2020 13:31
algolia_list.js
var Webflow = Webflow || [];
Webflow.push(function () {
//var query = window.location.pathname.split("/").slice(-1).toString().replace(/-/g, " ");
var query = window.location.pathname.split("/").slice(-1).toString().replace(/-/g, " ");
if (query.split(" ").length == 3){
query = query.split(" ")[0]
}
var options="";
if (query.toLowerCase() == "slack") {
options="&restrictSearchableAttributes=vendor,product";
@donalod
donalod / bitbucket_pipeline.yml
Last active November 2, 2020 13:32
bitbucket_pipeline.yml
#
# TODO: Need to account for multi-commit history in current commit rather than just merges.
# This could be done possibly with BITBUCKET_BUILD_NUMBER -1 but that doesn't account
# for broken builds or previous commits. Perhaps inc BUILD status? Reminder, we're
# looking to pull a list of JSON files that require publishing. Not sure if we tell
# people to squash commits before push? :)
# TODO: We could build a new array of files or push them by checking all commits since head
# with smth like: git log @{u}.. | grep -iE "commit [[:alnum:]]{40}" | cut -f2 -d" "
@donalod
donalod / squash.sh
Created May 25, 2020 10:23
Squash Current Git Commits
#!/usr/bin/env bash
echo -e "Squashing last commits since push...\n"
git reset --soft HEAD~$(git log @{u}.. | grep -i commit | wc -l | tr -d ' ') && git commit -am "$1"
#!/usr/bin/env bash
if [[ ${#1} = 0 ]]; then
echo "Note: First edit the script to update the JSON key and value to change."
echo "Usage: ./jq_replace_key_value_in_input_files.sh <file_glob_pattern>"
exit 0;
fi
key="og_image_url"