Skip to content

Instantly share code, notes, and snippets.

View kevinmcox's full-sized avatar

Kevin M. Cox kevinmcox

View GitHub Profile
@timothyham
timothyham / ipv6guide.md
Last active July 23, 2024 19:12
A Short IPv6 Guide for Home IPv4 Admins

A Short IPv6 Guide for Home IPv4 Admins

This guide is for homelab admins who understand IPv4s well but find setting up IPv6 hard or annoying because things work differently. In some ways, managing an IPv6 network can be simpler than IPv4, one just needs to learn some new concepts and discard some old ones.

Let’s begin.

First of all, there are some concepts that one must unlearn from ipv4:

Concept 1

@PicoMitchell
PicoMitchell / rosetter.sh
Last active January 4, 2024 17:22
"rosetter" is a shell/CLI tool to enable (or disable) opening apps using Rosetta on Apple Silicon Macs (as if you had clicked the "Open using Rosetta" checkbox in Finder).
#!/bin/sh
rosetter() ( # Notice "(" instead of "{" for this function, see THIS IS A SUBSHELL FUNCTION comments below.
# ABOUT ROSETTER
# "rosetter" is a shell/CLI tool to enable (or disable) opening apps using Rosetta on Apple Silicon Macs (as if you had clicked the "Open using Rosetta" checkbox in Finder).
# To enable opening apps using Rosetta, simply pass "rosetter" the app path(s) and/or bundle identifier(s) as arguments that you would like to enable opening using Rosetta (multiple app paths and/or bundle identifiers can be enabled at once).
# To disable opening apps using Rosetta, include the "--disable" (or "-d") argument along with the app path(s) and/or bundle identifier(s).
##
@jasonsnell
jasonsnell / networkquality.30m.py
Created February 10, 2023 21:37
NetworkQuality for SwiftBar
#! /usr/bin/python3
# <xbar.title>Network Quality</xbar.title>
# <xbar.version>v1.1</xbar.version>
# <xbar.author>Jason Snell</xbar.author>
# <xbar.author.github>jasonsnell</xbar.author.github>
# <xbar.desc>Display current network quality from networkQuality binary.</xbar.desc>
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
import json
@macshome
macshome / defang.md
Last active July 19, 2024 02:49
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.)

#!/bin/bash
# Get the current user and their UID
currentUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
currentUserID=$( id -u "$currentUser" )
# This is the line we need to add to enable TID
enableTouchID="auth sufficient pam_tid.so"
# Original sudo file location
@timsutton
timsutton / modify_screensharing.sh
Last active July 2, 2024 23:31
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>
@apizz
apizz / Install_AirPrint_Printer.sh
Last active July 8, 2024 02:18
Programmatically adds an AirPrint printer, ideally with an icon
#!/bin/bash
# Use the built-in ipp2ppd tool to create a PPD file for AirPrint
# Add icon to PPD (if we can get one) and install the printer
# Required printer info
readonly PRINTER_IP='XXX.XXX.XXX.XXX'
readonly PRINTER_NAME='PRINTER_NAME'
readonly PRINTER_DISPLAY_NAME='PRINTER NAME'
readonly PRINTER_LOCATION='PRINTER LOCATION'
@apizz
apizz / autopkg_cache_cleanup.sh
Created February 27, 2021 07:04
Given an autopkg cache path, will remove any download and pkg items older than X days
#!/bin/bash
# Script to find and delete .dmg, .pkg, .tar.gz, and .zip files from
# your autopkg cache
# Failed / incomplete downloads (prefixed with tmp) are also removed
# Number of days after which to delete matching files
readonly DAYS_TO_DELETE=7
# Path to autopkg Cache folder for current user
@nikolay-n
nikolay-n / defsmon.py
Last active October 29, 2022 14:26
Defaults Monitor - tool to sniff defaults keys and values using unified log
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
'''
Defaults Monitor - tool to sniff defaults keys and values using unified log
to launch use standard python 2.7, eg python2.7 ./defsmon.py
'''
import os
<?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>jonasb</string>
<key>creation_date</key>
<date>2020-04-02T13:42:34Z</date>