Skip to content

Instantly share code, notes, and snippets.

View timsutton's full-sized avatar
🍁

Timothy Sutton timsutton

🍁
View GitHub Profile
@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 / 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 / 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 / macos_marketing_name_from_sda.py
Created January 11, 2023 22:05
Print out macOS marketing name from SystemDesktopAppearance.framework
#!/usr/bin/env python3
# just a PyObjC example, this of course requires pyobjc also in your python (virtual)env
from Foundation import NSBundle, NSClassFromString
NSBundle.bundleWithPath_("/System/Library/PrivateFrameworks/SystemDesktopAppearance.framework").load()
sda_class = NSClassFromString('SystemDesktopAppearance')
print(sda_class.performSelector_('OSName'))
@timsutton
timsutton / count_github_asset_downloads.sh
Last active November 10, 2022 01:18
One-liner to give a total count of all downloads of a project's GitHub releases, over all time
owner=timsutton
repo=brigadier
curl -s "https://api.github.com/repos/${owner}/${repo}/releases \
| jq . \
| grep download_count \
| cut -d : -f 2 \
| tr -d ' ,' \
| awk '{s+=$1} END {print s}'
@timsutton
timsutton / modify_screensharing.sh
Last active July 26, 2024 20:58
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 / kickstart.pl
Created September 2, 2021 13:59
kickstart, macOS 11.5.2 (/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart)
#!/usr/bin/perl
#
## Copyright © 2002-2014, 2018 Apple Inc. All Rights Reserved.
##
## IMPORTANT NOTE: This file is licensed only for use on Apple-branded
## computers and is subject to the terms and conditions of the Apple Software
## License Agreement accompanying the package this file is a part of.
## You may not port this file to another platform without Apple's written consent.
#
@timsutton
timsutton / gist:b97e5b6eebf505692be3435d78563ec9
Created June 3, 2021 19:30
Output of `system_profiler SPSmartCardsDataType -xml` from a vanilla 10.14.6 system
<?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">
<array>
<dict>
<key>_SPCommandLineArguments</key>
<array>
<string>/usr/sbin/system_profiler</string>
<string>-nospawn</string>
<string>-xml</string>
@timsutton
timsutton / join_zoom.sh
Created June 7, 2019 11:27
shell alias to join the currently-scheduled Zoom meeting on my calendar
join_zoom() {
# Joins the first Zoom meeting URL found in events happening now on
# your calendar, by searching their descriptions/locations info for
# "zoom.us" URLs, and opening them using `open`
#
# Another option for launching Zoom is directly, via its own URL handler like
# zoommtg://zoom.us/join?confno=123456789, but not sure how this works
# with static meeting URLs like zoom.us/my/myusername, and seems it
# could change in Zoom app updates, whereas the web URLs will always know
# what to do.