Skip to content

Instantly share code, notes, and snippets.

View timsutton's full-sized avatar
🍁

Timothy Sutton timsutton

🍁
View GitHub Profile
@timsutton
timsutton / modify_screensharing.sh
Last active April 29, 2024 09:46
Enabling screen sharing on macOS Monterey as of 12.1 beta 2
#!/bin/bash
# A cleaner alternative to this approach, but which requires a restart, is to populate TCC's SiteOverrides.plist inside
# the TCC app support directory with the following:
# <?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>Services</key>
# <dict>
@timsutton
timsutton / uptime.sh
Last active March 20, 2024 15:51
Simple uptime in pure macOS shell
#!/bin/bash
set -eu -o pipefail
function machine_uptime_seconds() {
boottime=$(sysctl -n kern.boottime | perl -n -e'/^.* sec = (\d+)?\,.*$/; print $1')
now=$(date +%s)
uptime=$((now - boottime))
echo $uptime
}
@timsutton
timsutton / gist:b1affb996a2aa60b7927
Last active March 1, 2024 17:53
Pulling appcast URLs from brew-cask: about 500 so far
# list all local cask files and find the 'appcast' stanza
# - assumes you have brew cask installed:
# brew install caskroom/cask/brew-cask
for cask in `ls /usr/local/Library/Taps/caskroom/homebrew-cask/Casks | awk -F"." '{print $1}'`; do
cast=$(brew cask cat ${cask} | grep appcast | awk '{print $2}')
[ -n "${cast}" ] && echo "${cask}: ${cast}" | grep http
done
a-better-finder-attributes: 'http://www.publicspace.net/app/signed_abfa5.xml'
a-better-finder-rename: 'http://www.publicspace.net/app/signed_abfr9.xml'
@timsutton
timsutton / proxygen_build.log
Created January 17, 2024 01:16
proxygen `build.sh` error on macOS 14.2, Xcode 15.2
➜ proxygen git:(main) ✗ ./build.sh
+++ dirname ./build.sh
++ cd .
++ pwd
+ BASE_DIR=/Users/tim/git/proxygen/proxygen
+ COLOR_RED='\033[0;31m'
+ COLOR_GREEN='\033[0;32m'
+ COLOR_OFF='\033[0m'
+ JOBS=8
+ INSTALL_DEPENDENCIES=true
@timsutton
timsutton / apfs_cli_tools.txt
Last active December 21, 2023 04:54
apfs tools in Sierra
➜ ~ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.1
BuildVersion: 16B2333a
➜ ~ ls -l /System/Library/Filesystems/apfs.fs/Contents/Resources
total 2088
-rwxr-xr-x 1 root wheel 349760 22 Sep 03:48 apfs.util
-rwxr-xr-x 1 root wheel 352880 22 Sep 03:48 apfs_invert
@timsutton
timsutton / dvt_index_dec14.plist
Last active December 14, 2023 14:20
Diff of https://devimages-cdn.apple.com/downloads/xcode/simulators/index2.dvtdownloadableindex from Dec. 6 to 14, 2023. Note change in `maxHostVersion` for iOS 14.5.
<?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>downloadables</key>
<array>
<dict>
<key>category</key>
<string>simulator</string>
<key>contentType</key>
@timsutton
timsutton / benchmark_hyperfine_envoy.sh
Last active December 6, 2023 14:30
Example benchmark of bazel building envoy using hyperfine.sh
#!/bin/bash
#
# Example of using hyperfine to benchmark bazel-based builds of Envoy proxy:
# https://github.com/envoyproxy/envoy/
target="//source/exe:envoy_main_common_lib"
# Other examples of targets:
# main binary
# target="//source/exe:envoy-static"
@timsutton
timsutton / profile_managedclient_type.xml
Created May 26, 2013 16:45
Sample com.apple.ManagedClient.preferences .mobileconfig
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.apple.SoftwareUpdate</key>
<dict>
<key>Forced</key>
<array>
<dict>
@timsutton
timsutton / rename_ios_devices.py
Created August 24, 2016 19:33
Simple script to rename connected iOS devices according to a CSV file, using Apple Configurator 2's cfgutil command.
#!/usr/bin/python
#
# Simple script to batch-rename attached iOS devices according to UUID to name mappings
# in a CSV file.
#
# Usage: rename_devices.py <csvfile>
#
#
# The CSV file should be comma-separated and contain at least the 'udid' and 'name'
# fields. Such a CSV can be exported from Configurator. Any additional field will simply
@timsutton
timsutton / record_screencap.py
Created March 16, 2016 18:48
Screen recording with Python and AVFoundation
#!/usr/bin/python
# pylint: disable-msg=e1101,e0611
import time
import AVFoundation as AVF
import Quartz
from Foundation import NSObject, NSURL
def main():