Skip to content

Instantly share code, notes, and snippets.

View elliotberry's full-sized avatar
🌍
online

ɛʟʟɨօȶ b =^._.^= ∫ elliotberry

🌍
online
View GitHub Profile
@elliotberry
elliotberry / gist:5101978a81c057568746f5a5bb8124ff
Created August 28, 2025 07:23 — forked from rctphone/gist:62f75cf2f0293bdc9dd27eebac1d5c61
How to solve "APFS inverter failed to invert the volume" error
After cloning APFS drives using Disk Utility it usually ends with a volume containing ContainerToInvert file with the size of a cloned partition.
Don't be afraid, using the following steps you can mount this file as APFS container and get all partitions.
1. Requirements
We need FUSE and xmount installed
2. Terminal
Open Terminal app and type the following:
$ sudo mkdir /Volumes/apfs_image/
@ph33nx
ph33nx / cleanup_and_harden_macos.sh
Last active October 30, 2025 20:05
Automated macOS Sequoia Hardening & Cleanup Bash Script – Disable Telemetry, Turn Off Spotlight Indexing, Purge Caches & Logs for Privacy and Security (sysadmin, macOS harden, privacy, disable telemetry, cleanup script)
#!/usr/bin/env bash
###############################################################################
# Author: ph33nx
# URL: https://github.com/ph33nx
#
# Description:
# This bash script automates the process to harden macOS (tested on Sequoia 15.5) by disabling
# or minimizing telemetry, turning off Spotlight indexing, and performing
# routine cleanup of caches, logs, temporary files, and the Trash. It is ideal
# for sysadmins, power users, and privacy-focused developers who want to:
@kconner
kconner / macOS Internals.md
Last active November 6, 2025 09:43
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:

Term Description
1TR One True Recovery; booting into macOS recovery on Apple Silicon by holding the power button to verify physical presence; enables interaction with SEP to change Boot Policy
AA Apple account
AA Apple Archive, see also Apple Encrypted Archive; command line tools: aa, aea, compression_tool
AAC Automatic Assessment Configuration; AutomaticAssessmentConfiguration.framework; puts device in a locked mode for exam-style test applications
AAT Apple Advanced Typography; font format and rendering engine
Accounts launchd service: com.apple.accountsd; /System/Library/Accounts
ACDE Apple Connect Device External? ACDEClient.framework, old two-step verification, derived from a company-internal AppleConnect system? server: appleconnect.apple.com
ACFS Apple Clustered File System; deprecated file system for Xsan; acfs.framework
Acoustic ID Siri feature to recognize songs
@psenger
psenger / async_iterator_to_stream.js
Created September 8, 2022 06:02
[Piping to Writable Streams from Async Iterators] #JavaScript #NodeJS #Stream
const { once } = require('events');
const finished = util.promisify(stream.finished);
const writable = fs.createWriteStream('./file');
(async function() {
for await (const chunk of iterator) {
// Handle backpressure on write().
if (!writable.write(chunk))
await once(writable, 'drain');
#!/bin/bash
#set -eux
AIRPODS_NAME='Greg’s AirPods Pro'
OUTPUT='🎧'
BLUETOOTH_DEFAULTS=$(defaults read /Library/Preferences/com.apple.Bluetooth)
SYSTEM_PROFILER=$(system_profiler SPBluetoothDataType 2>/dev/null)
MAC_ADDR=$(grep -b3 "Minor Type: Headphones"<<<"${SYSTEM_PROFILER}"|grep -a1 ${AIRPODS_NAME}|awk '/Address/{print $3}')
@psenger
psenger / asyncHookContext.js
Last active December 6, 2022 00:19
[NodeJS Performance Hooks with Async Hooks] #NodeJS #AsyncHook
// @see https://blog.besson.co/nodejs_async_hooks_to_get_per_request_context/
const asyncHooks = require( 'async_hooks' );
const { v4: uuidv4 } = require( 'uuid' );
const store = new Map();
// The executionAsyncId() - the identifier of the current execution context.
const getExecutionAsyncId = () => asyncHooks.executionAsyncId();
// The triggerAsyncId() - The identifier of the parent resource that triggered the execution of the async resource.
@akemin-dayo
akemin-dayo / gfnpaste-macos
Last active February 21, 2023 23:49
An extremely simple tool for macOS (Linux version also available) that simply simulates typing out the contents of your clipboard into apps that do not support clipboard sharing, like NVIDIA GeForce NOW.
#!/usr/bin/env bash
# gfnpaste-macos
# Karen/あけみ (akemin_dayo)
# https://gist.github.com/akemin-dayo/44ccf96a892c2219f6c9f12a7bd966cc.git
# This is an extremely simple tool for macOS (Linux version also available) that simply simulates typing out the contents of your clipboard into apps that do not support clipboard sharing, like NVIDIA GeForce NOW.
# Such apps include:
# * NVIDIA GeForce NOW (GeForceNOW.app) - No clipboard sharing support.
# * Parsec (Parsec.app) — Clipboard sharing is only enabled when connecting to your own machine, and is disabled when connecting to someone else's.
# For those who does not care iCloud and stock mac Applications
# As well as stopping Spotlight completley
# tested on bigsur (Intel and M )
#!/bin/bash
# Reboot your Mac into Recovery Mode
# Terminal from top menu
# csrutil disable
# csrutil authenticated-root disable
@shreyas-v-agnihotri
shreyas-v-agnihotri / notion-fruition-cloudflare-script-v2.js
Created September 2, 2021 17:15
A Cloudflare script, built with Fruition, to allow my custom domain to point to my personal Notion site and inject custom CSS and JS.
/* CONFIGURATION STARTS HERE */
/* Step 1: enter your domain name like fruitionsite.com */
const MY_DOMAIN = 'shreyasagnihotri.com';
/*
* Step 2: enter your URL slug to page ID mapping
* The key on the left is the slug (without the slash)
* The value on the right is the Notion page ID
*/