This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python -u | |
import re | |
from datetime import datetime | |
import click | |
import subprocess | |
import json | |
""" | |
NOTE: this requires a log config profile that enables 'private data' logging. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use scripting additions | |
use framework "Foundation" | |
tell application "Finder" | |
-- path to frontmost Finder window | |
set windowPath to POSIX path of (target of front window as alias) | |
-- selected items in Finder, if any | |
set itemlist to selection as alias list | |
if length of itemlist > 0 then | |
repeat with i from 1 to length of itemlist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http.server | |
import socketserver | |
import random | |
import os | |
import uuid | |
from http import HTTPStatus | |
''' | |
I wanted a quick way to spawn a bunch of Safari tabs with distinct favicons, so made a little webserver | |
to rotate through some PNGs. A substantially smaller program was sufficient for Chrome, which does what |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>PayloadContent</key> | |
<array> | |
<dict> | |
<key>PayloadDisplayName</key> | |
<string>ManagedClient logging</string> | |
<key>PayloadEnabled</key> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Scenario: | |
# - you have a local checkout of a github repo | |
# - you're looking at public forks of that repo | |
# - you want to add a remote to your local checkout for one of the forks | |
set -e | |
set -o pipefail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
""" | |
Configure the arguments to the process_directory call at the bottom. | |
Start additional instances of this script until your hw is full. If you | |
have multiple GPUs, you're responsible for setting CUDA_VISIBLE_DEVICES. | |
Using the 'medium' model, a V100 is mostly utilized with two instances. | |
This still has some bugs probably... | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python -u | |
import subprocess | |
import plistlib | |
import sys | |
""" | |
Print selected power metrics from /usr/bin/powermetrics at intervals, suitable | |
for graphing. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
By Andre LaBranche, with extensive help from your friend and mine, ChatGPT. | |
In other words, assume this code eats babies. | |
This program attempts to be a reasonably inexpensive replacement for | |
/usr/bin/pidpersec.d in macOS, which still ships, but is broken by default | |
(i.e. when SIP is enabled). | |
compile with: clang -o pidpersec pidpersec.c | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find /System/Library/LaunchDaemons /System/Library/LaunchAgents -name "*.plist" \ | |
| while read p ; do plutil -convert json -o - ${p} \ | |
| jq -r ' .. | objects | with_entries(select(.key == "Notification")) | select(. != {}).Notification' | |
done | sort -u > ~/Desktop/all-launchd-notifications.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# | |
# Batch transcribe audio files with whisper.cpp and ffmpeg | |
# This script wants: | |
# - ffmpeg installed and accessible via $PATH | |
# - whisper.cpp built locally: | |
# git clone https://github.com/ggerganov/whisper.cpp | |
# cd whisper.cpp | |
# make | |
# The compiled binary will be called 'main' in the whisper.cpp directory. |
NewerOlder