Skip to content

Instantly share code, notes, and snippets.

View n8felton's full-sized avatar
🍎

Nate Felton n8felton

🍎
View GitHub Profile
@n8felton
n8felton / Makefile.version
Created August 9, 2023 15:32 — forked from grihabor/Makefile.version
Makefile to use for incremental semantic versioning
MAKE := make --no-print-directory
DESCRIBE := $(shell git describe --match "v*" --always --tags)
DESCRIBE_PARTS := $(subst -, ,$(DESCRIBE))
VERSION_TAG := $(word 1,$(DESCRIBE_PARTS))
COMMITS_SINCE_TAG := $(word 2,$(DESCRIBE_PARTS))
VERSION := $(subst v,,$(VERSION_TAG))
VERSION_PARTS := $(subst ., ,$(VERSION))
@n8felton
n8felton / darwin_env_var.sh
Created March 30, 2023 17:07 — forked from carlashley/darwin_env_var.sh
Darwin Environment Variables
#!/bin/sh
# User path
/usr/bin/getconf DARWIN_USER_DIR
# Temp directory
# Note - $TMPDIR is the same as this
/usr/bin/getconf DARWIN_USER_TEMP_DIR
# Cache directory
@n8felton
n8felton / com.apple.notificationsettings.BTMNotificationAgent.plist
Created October 20, 2022 12:43
Example MDM profile for disabling BTM notifications
<?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>PayloadContent</key>
<array>
<dict>
<key>NotificationSettings</key>
<array>
<dict>
@n8felton
n8felton / com.apple.servicemanagement.plist
Created October 20, 2022 01:10
Example MDM profile for Login and Background Item Management
<?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>PayloadContent</key>
<array>
<dict>
<key>PayloadDescription</key>
<string>Login and Background Item Management</string>
<key>PayloadDisplayName</key>
@n8felton
n8felton / original_service.plist
Created October 3, 2022 21:48
Comparing generated launchd.plist from before and after changes to github.com/kardianos/service
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version='1.0'>
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>test</key>
<string>1</string>
<key>toor</key>
@n8felton
n8felton / com.apple.system.logging.enable-private-data.alf.mobileconfig
Created April 18, 2022 20:49
Enable ALF unified logging system private data
<?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>PayloadContent</key>
<array>
<dict>
<key>PayloadDisplayName</key>
<string>Enable ALF unified logging system private data</string>
<key>PayloadIdentifier</key>
@n8felton
n8felton / com.apple.system.logging.enable-private-data.mobileconfig
Created April 18, 2022 17:48
Enable unified logging system private data logging
<?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>PayloadContent</key>
<array>
<dict>
<key>PayloadDisplayName</key>
<string>Enable unified logging system private data logging</string>
<key>PayloadIdentifier</key>
@n8felton
n8felton / kcpasswordEncode.sh
Created January 19, 2022 03:39 — forked from brunerd/kcpasswordEncode.sh
Encode a string for use in macOS /etc/kcpassword using shell, printf, sed, awk and xxd
#!/bin/bash
#kcpasswordEncode (20210911) Copyright (c) 2021 Joel Bruner (https://github.com/brunerd)
#Licensed under the MIT License
#given a string creates data for /etc/kcpassword
function kcpasswordEncode {
#ascii string
local thisString="${1}"
local i
@n8felton
n8felton / nvram.py
Last active December 7, 2021 00:27 — forked from pudquick/nvram.py
Get nvram values via python and pyobjc on macOS
import objc
from Foundation import NSBundle
IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit')
functions = [
("IORegistryEntryFromPath", b"II*"),
("IORegistryEntryCreateCFProperty", b"@I@@I"),
]
@n8felton
n8felton / alpn-responder.py
Last active August 13, 2021 13:36
dehydrated ACME TLS-ALPN-01 Responder
#!/usr/bin/env python3
import ssl
import socketserver
import threading
import re
import os
ALPNDIR="/etc/dehydrated/alpn-certs"
PROXY_PROTOCOL=False