Skip to content

Instantly share code, notes, and snippets.

View timsutton's full-sized avatar
🍁

Timothy Sutton timsutton

🍁
View GitHub Profile
#!/bin/zsh
# WARNING! The script is meant to show how and what can be disabled. Don’t use it as it is, adapt it to your needs.
# Credit: Original idea and script disable.sh by pwnsdx https://gist.github.com/pwnsdx/d87b034c4c0210b988040ad2f85a68d3
# Disabling unwanted services on macOS Big Sur (11), macOS Monterey (12), macOS Ventura (13) and macOS Sonoma (14)
# Disabling SIP is required ("csrutil disable" from Terminal in Recovery)
# Modifications are written in /private/var/db/com.apple.xpc.launchd/ disabled.plist, disabled.501.plist
# To revert, delete /private/var/db/com.apple.xpc.launchd/ disabled.plist and disabled.501.plist and reboot; sudo rm -r /private/var/db/com.apple.xpc.launchd/*
# user
@macshome
macshome / GetProcessList.swift
Last active January 9, 2024 15:05
Swift Playground to get all running processes on macOS
import Darwin
func getProcessList() {
// Requesting the pid of 0 from systcl will return all pids
var mib = [CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0]
var bufferSize = 0
// To find the needed buffer size you call sysctl with a nil results pointer.
// This sets the size of the buffer needed in the bufferSize pointer.
if sysctl(&mib, UInt32(mib.count), nil, &bufferSize, nil, 0) < 0 {
@spenserhale
spenserhale / git-batch-push.sh
Last active March 5, 2024 19:21
When your repo exceeds upload limit (GitHub 2GB), you can push in batches so you can store up to total size limit. (100GB) (Warning uses force push, ideally should be used for setting up new remote, once)
# Adjust the following variables as necessary
REMOTE=origin
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BATCH_SIZE=250
# check if the branch exists on the remote
if git show-ref --quiet --verify refs/remotes/$REMOTE/$BRANCH; then
# if so, only push the commits that are not on the remote already
range=$REMOTE/$BRANCH..HEAD
else
@macshome
macshome / defang.md
Last active April 24, 2024 18:31
How to defang system protections on macOS

How to Defang macOS System Protections

If you want to change things on the root drive of a Mac you will need to take some steps to disable the built in security of the system. Most of these steps are the same regardless if you are on Intel or Apple Silicon. If there is a difference it is noted.

Note that all of these things put a Mac into an unsupported and less secure state.

Make sure you either perform these steps in a VM or that you reset the protections after you are done poking around

Protections and Terms

(This list is not exahustive on the details of each. Check the links at the end for more info.)

@b0gdanw
b0gdanw / Disable-Ventura-Bloatware.sh
Last active March 27, 2024 12:05
Disable Ventura Bloatware
#!/bin/zsh
# Credit: Original idea and script disable.sh by pwnsdx https://gist.github.com/pwnsdx/d87b034c4c0210b988040ad2f85a68d3
# Disabling unwanted services on macOS Big Sur (11), macOS Monterey (12) and macOS Ventura (13)
# Disabling SIP is required ("csrutil disable" from Terminal in Recovery)
# Modifications are written in /private/var/db/com.apple.xpc.launchd/ disabled.plist, disabled.501.plist
# To revert, delete /private/var/db/com.apple.xpc.launchd/ disabled.plist and disabled.501.plist and reboot; sudo rm -r /private/var/db/com.apple.xpc.launchd/*
# user
@jklausa
jklausa / xcode-curl.sh
Last active April 20, 2022 14:24
curl Xcode
#!/bin/bash
# Useful for downloading Xcode on machines where you don't want to log-in with your Apple ID (e.g. CI
# machines, or other low-trust environemnts).
# Requires you to manually log-in to the Apple Dev Portal, and extract contents of the ADCDownloadAuth cookie
# (easiest way to do it is using Web Inspector, going to the "Storage" Pane, selecting "Cookies" in the left sidebar,
# and copying the appropriate value.
#
# Usage:
# curl https://gist.githubusercontent.com/jklausa/5780d5126d97f73b70a91aeab58f7f4a/raw/ | bash -s -- XCODE-URL COOKIE_VALUE
@alexellis
alexellis / GUIDE.md
Last active July 31, 2023 10:51
Equinix Metal is my computer

From my blog post: The Internet is my computer

Equinix Metal is my computer

Run hosted VSCode on Equinix Metal's huge: AMD Epyc instances with 64GB RAM and 24 Cores, coupled with a bonded 2 x 10 Gbps uplink to the Internet.

Hosted VSCode

  • Provision your Ubuntu 20.04 LTS server using the dashboard and add your SSH key
  • Once you have the public IP, log in over SSH
@Maxattax97
Maxattax97 / README.md
Last active November 13, 2023 12:10 — forked from magnetikonline/README.md
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script to:

  • Iterate all commits made within a Git repository.
  • List every object at each commit.
@mattmc3
mattmc3 / 1-setopts.zsh
Last active January 2, 2024 15:47
ZSH - options by framework
## ZSH Options
# http://zsh.sourceforge.net/Doc/Release/Options.html
# Changing Directories
# http://zsh.sourceforge.net/Doc/Release/Options.html#Changing-Directories
setopt auto_cd # if a command isn't valid, but is a directory, cd to that dir
setopt auto_pushd # make cd push the old directory onto the directory stack
setopt pushd_ignore_dups # don’t push multiple copies of the same directory onto the directory stack
setopt pushd_minus # exchanges the meanings of ‘+’ and ‘-’ when specifying a directory in the stack