Skip to content

Instantly share code, notes, and snippets.

View timsutton's full-sized avatar
🍁

Timothy Sutton timsutton

🍁
View GitHub Profile
@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 / isBaroloOrLater.perl
Last active February 24, 2022 21:43
kickstart script from Apple Remote Desktop 3.5.3 update: http://support.apple.com/kb/DL1532. Path to kickstart: /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart
#!/usr/bin/perl
# Copyright (c) 2002-2009, Apple, Inc. All Rights Reserved.
sub Usage1
{
qq{
kickstart -- Quickly uninstall, install, activate, configure, and/or restart
components of Apple Remote Desktop without a reboot.
kickstart -uninstall -files -settings -prefs
@timsutton
timsutton / ProTools12-12.5.2.plist
Last active February 7, 2022 19:47
pkginfo for Pro Tools 12.5.2
<?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>_metadata</key>
<dict>
<key>created_by</key>
<string>tsutton</string>
<key>creation_date</key>
<date>2016-07-04T18:46:13Z</date>
@timsutton
timsutton / Settings_DisableIncomingBluetoothAudio.mobileconfig
Last active October 18, 2021 07:02
disable bluetooth incoming audio requests profile
<?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>PayloadContent</key>
<dict>
<key>com.apple.Bluetooth.ByHost</key>
@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 / Popen_quit_by_pid.py
Last active July 15, 2021 11:14
Two examples of launching an application and quitting it using `NSRunningApplication.terminate()`
#!/usr/bin/python
# Alternate example using subprocess.Popen and finding the NSRunningApplication by PID
import AppKit
from time import sleep
from Foundation import NSURL
proc = subprocess.Popen(['/Applications/Xcode.app/Contents/MacOS/Xcode'])
@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.
@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 / gist:2c38c1fb90383e8093bec3d90b88929b
Last active May 26, 2021 17:26
Spotify Mac executable modes in 1.0.50 vs. 1.0.49
# In 1.0.50, no user besides the one who installed Spotify will be able to execute it. This means either other users on the system,
# or, if Spotify was deployed using any mass-deployment tool or installer package, and is owned by the root user, Spotify will not
# launch for anyone.
# Dir listing comparisons courtesy of https://github.com/poundbangbash
# 1.0.50
$ ls -l /Volumes/Spotify/Spotify.app/Contents/MacOS/
total 63160
-rwxr--r-- 1 homeadmin staff 30076384 Mar 1 13:36 Spotify