Skip to content

Instantly share code, notes, and snippets.

View jonathanweinberg's full-sized avatar

Jonathan Weinberg jonathanweinberg

View GitHub Profile
sudo scutil --set ComputerName $HOSTNAME
sudo scutil --set HostName $HOSTNAME
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
mkdir -p "${HOME}/Pictures/Screenshots"
defaults write com.apple.screencapture "location" -string "${HOME}/Picures/Screenshots"
defaults write com.apple.screencapture "type" -string "png"
@kconner
kconner / macOS Internals.md
Last active October 8, 2025 16:45
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@stefanschmidt
stefanschmidt / download_all_tweets.go
Created November 26, 2022 17:02
Download all tweets of a user without requiring an API key
// To my knowledge the only solution available that:
// - does not require an API key with "elevated access" (most other solutions need this, requires an application)
// - does not require an API key with "essential access" (requires a valid cell phone number to enable)
// - does not require any type of API key
// - isn't outdated or otherwise broken
//
// Can (probably) download up to 3200 tweets
//
// brew install go
// go run download_all_tweets.go
@othyn
othyn / guide.md
Last active October 15, 2025 04:15
Fix horrendously bad macOS (12.3.1 tested) SMB (Samba) performance on Unraid

Intro

Out of the box, my SMB performance on macOS 12.3.1 would top out at around 20MB/s in short ~5 second bursts, which was absolutely horrendous, slow to navigate in Finder and slugish to interact with.

Since making these changes, I now get sustained ~80-100MB/s+ and instant Finder navigation which is superb and how things should be out-of-the-box (OOTB)!

May 2023 update: As of Ventura, the SMB issues were just horribly inconsistent and hard to maintain. Something in the combination of Unraid, macOS and SMB just doesn't play nice. I ended up binning NFS/SMB all together and heading to a locally hosted Nextcloud instance for file syncing, then using SFTP/Ansible Git flow for editing files within appdata.

Sources

@timsutton
timsutton / modify_screensharing.sh
Last active May 1, 2025 05:33
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>
// ==UserScript==
// @name ZZZZOTAC "Add to cart"
// @namespace http://tampermonkey.net/
// @version 0.0.1
// @description Waits for a Zotac drop.. and adds to cart, from the product page, or from the product listing page (e.g. search, or category)
// @author Falcodrin Community - Mentalow#7935
// @match https://www.zotacstore.com/us/*
// @run-at document-start
// @grant GM.xmlHttpRequest
// @connect events.pagerduty.com
@maelvls
maelvls / README.md
Last active July 9, 2022 13:25
Stuff about Synology OS. Moved to https://hackmd.io/8bZlqm9sQh6b0HH7Jr2YzA
var fs = require('fs');
function readJsonFile(fileName) {
var buf = fs.readFileSync(fileName);
return JSON.parse(buf.toString('utf8'));
}
var deviceRegistry = readJsonFile('./.storage/core.device_registry')
var devices = deviceRegistry.data.devices;
var smokeDetectors = {};
for (var device of devices) {
@sbyx
sbyx / low-battery-level-detection-notification-for-all-battery-sensors.yaml
Last active October 18, 2025 08:33
Home Assistant Blueprint: Low battery level detection & notification for all battery sensors
blueprint:
name: Low battery level detection & notification for all battery sensors
description: Regularly test all sensors with 'battery' device-class for crossing
a certain battery level threshold and if so execute an action.
domain: automation
input:
threshold:
name: Battery warning level threshold
description: Battery sensors below threshold are assumed to be low-battery (as
well as binary battery sensors with value 'on').
@marccarre
marccarre / list_kindle_releases.py
Created October 24, 2020 08:46
List all available versions of Kindle for Mac and Kindle for PC.
#!/usr/bin/env python
'''
List all available versions of Kindle for Mac and Kindle for PC.
Dependencies:
- asyncio==3.4.3
- aiohttp==3.6.3
'''
import os
import sys