Skip to content

Instantly share code, notes, and snippets.

@varenc
varenc / siri_recording_save.sh
Last active March 5, 2023 08:28
Siri on macOS: Copy and save all Siri audio recordings as .wav files
#!/bin/zsh
###################
# Save all of your Siri recordings on macOS. The recordings will be saved as .wav files in $SIRI_SAVE_DIR
#
# USAGE:
# $ wget https://gist.githubusercontent.com/varenc/8cae8f19fede79f63b84cc85f602f382/raw/siri_recording_save.sh
# $ chmod +x siri_recording_save.sh
# $ ./siri_recording_save.sh
#
@varenc
varenc / zshexpn-explained.md
Created November 26, 2022 02:01 — forked from roblogic/zshexpn-explained.md
Regular Expressions in Zsh

The following is taken from a brilliant answer on unix.se. Posting it here for personal reference. The question was:

${var//pattern/replacement} is using zsh wildcard patterns for pattern, the same ones as used for filename generation aka globbing which are a superset of the sh wildcard patterns. The syntax is also affected by the kshglob and extendedglob options. The ${var//pattern/replacement} comes from the Korn shell initially.

I'd recommend enabling extendedglob (set -o extendedglob in your ~/.zshrc) which gives you the most features (more so than standard EREs) at the expense of some backward incompatibility in some corner cases.

You'll find it documented at info zsh 'filename generation'.

@varenc
varenc / system_profiler_SPDisplaysDataType.json
Created November 24, 2022 00:27
`system_profiler -json SPDisplaysDataType` output on a MBP 16" 2019
{
"SPDisplaysDataType" : [
{
"_name" : "kHW_IntelUHDGraphics630Item",
"_spdisplays_vram" : "1536 MB",
"spdisplays_automatic_graphics_switching" : "spdisplays_supported",
"spdisplays_device-id" : "0x3e9b",
"spdisplays_gmux-version" : "5.0.0",
"spdisplays_metalfamily" : "spdisplays_mtlgpufamilymac2",
"spdisplays_ndrvs" : [
@varenc
varenc / README.md
Last active April 18, 2023 10:29
Homebrew patch to spoof a particular macOS version to allow you to force install pre-compiled binary bottles anywhere

Force brew to install pre-compiled binary bottles on older versions of macOS (Mojave).

This patch makes a small modification to Homebrew allowing you to "spoof" or override its perceived macOS version. Often compiled bottles will work fine on older unsupported macOS verisons and using a bottle means you don't have to compile a formula from scratch or download and compile its build-only dependencies.

Of course you shouldn't do this unless you're very familiar Homebrew internals and understand the limitations. Things make break in a very confusing way. Most users should just keep macOS up to date, but for those that can't this patch may be helpful.

To use, first download and install the patch:

$ cd "$(brew --repo)"
$ wget "https://gist.githubusercontent.com/varenc/47c4b22e2b8c5afabce556645a90801d/raw/homebrew_override_version.patch" --output-document=/tmp/homebrew_override_version.patch
@varenc
varenc / profile_defaults.md
Created May 6, 2022 01:37 — forked from dlevi309/profile_defaults.md
An extensive list of settings written when installing a debugging profile from developer.apple.com

MediaPlayer logging:

defaults: {
    "com.apple.homesharing" =     {
        HSConsoleLoggingLevel = 7;
        HSLogFileLoggingLevel = 7;
        HSLogging = 1;
    };
    "com.apple.medialibrary" =     {
@varenc
varenc / studio_display_catalina_fix.md
Last active June 22, 2023 01:50
Fix Studio Display apps freezing macOS 10.15 Catalina (Chrome, Zoom, WhatsApp, Discord, etc)

tl;dr; Run sudo launchctl stop com.apple.cmio.VDCAssistant to unfreeze your apps while using a Studio Display on macOS Catalina.


If you try to use Apple's new Studio Display on macOS Catalina 10.15.7 you end up with horrible app freezing problems. Apps like Chrome, Discord, WhatsApp, Zoom, Messenger, etc, are all freezing once a Studio Display is plugged in.

As someone pointed out on this thread, the "VDCAssistant" process seems to the source of the problems. This process is just related to managing video cameras for Apple services. And apparently disabling it fixes the app freezing issue!

So to fix the issue, just temporarily disable VDCAssistant by running this command in a Terminal:

@varenc
varenc / _retrieve_mac_apps.sh
Last active March 29, 2022 23:41
Fix macOS zsh `open -a` application completion! Apple's version has a very old bug. See: https://stackoverflow.com/questions/59865427/zsh-hangs-on-open-application-tab-autocompletion#63097652
#autoload
### 2022-02-09 @varenc
### This is a fixed version of the macOS zsh completion script for the `open` command.
### See my response here for a description of the bug:
### https://stackoverflow.com/questions/59865427/zsh-hangs-on-open-application-tab-autocompletion#63097652
###
### tl;dr; The original completion script is provided by Apple and not-editable by the user without disabling SIP.
### It has a bug in it and doesn't use the Spotlight index to list applications. This makes auto-completion
### for the command "open -a ..." very slow/impossible.
@varenc
varenc / potentially_missing_big_sur_security_fixes.md
Last active January 26, 2022 23:04
Monterey 12.2 security update fixes not present in Big Sur 11.6.3 update

About

This is a list of the Monterey 12.2 security updates not present in the Big Sur 11.6.3 security update. It's unclear if Big Sur is vulnerable to these or not. If Big Sur is though then they appear unpatched at the moment.


AMD Kernel

Available for: macOS Monterey

Impact: A malicious application may be able to execute arbitrary code with kernel privileges

@varenc
varenc / launchctl_man_pages.md
Created January 6, 2022 00:49 — forked from dmattera/launchctl_man_pages.md
macOS man page entries for launchctl services

This list was auto-generated on macOS 10.15 (Catalina) using a script that did the following:

  1. grabbed the name of all the .plist files located in the 5 folders used by launchctl:
  • ~/Library/LaunchAgents Per-user agents provided by the user.
  • /Library/LaunchAgents Per-user agents provided by the administrator.
  • /Library/LaunchDaemons System wide daemons provided by the administrator.
  • /System/Library/LaunchAgents OS X Per-user agents.
  • /System/Library/LaunchDaemons OS X System wide daemons.
@varenc
varenc / README.md
Last active December 4, 2021 22:03 — forked from Jahhein/README.md
Display Apple AirPods battery levels via Terminal