Skip to content

Instantly share code, notes, and snippets.

View n8felton's full-sized avatar
🍎

Nate Felton n8felton

🍎
View GitHub Profile
@n8felton
n8felton / letsencrypt_esxi.sh
Created February 10, 2021 21:09 — forked from shr00mie/letsencrypt_esxi.sh
Let's Encrypt SSL for ESXi
#!/bin/bash
#
## -----------------------------=[ WARNING ]=-------------------------------- ##
#
# This script is now woefully out of date due to which accounts ESXi allows to
# ssh into the box as well as sticky folders/file flags.
# I've since ported the whole thing to python with a lot of bells and whistles
# and if i get around to making it public, i'll put a link here.
#
## -------------------------------=[ Info ]=--------------------------------- ##
#!/usr/local/munki/munki-python
import plistlib, os.path, os, logging, pprint
# Based off of https://forums.developer.apple.com/message/6741
# and http://apple.stackexchange.com/a/136976
# Downloaded from https://gist.github.com/pudquick/349f063c242239952a2e
log_fmt = "[%(asctime)s] [%(levelname)-8s] %(message)s"
logging.basicConfig(format=log_fmt, level=logging.DEBUG)
@n8felton
n8felton / README.md
Created November 25, 2019 15:08 — forked from heywoodlh/README.md
Auth logging on MacOS using the log command
mkdir -p /opt/scripts
mkdir -p /var/log/custom
mkdir -p /var/root/Library/LaunchAgents


curl 'https://gist.githubusercontent.com/heywoodlh/0295135b9e24ec0729571497c9ab5a77/raw/b3032d9a563c956f574176c39cb2a5382f8c579c/auth-log.sh' -o /opt/scripts/auth-log.sh
chmod +x /opt/scripts/auth-log.sh

@n8felton
n8felton / autopkg.patch
Last active October 10, 2019 13:35
RECIPE_SEARCH_DIRS with RECIPE_REPO_DIR default
diff --git a/Code/autopkg b/Code/autopkg
index d0747bc..e9db986 100755
--- a/Code/autopkg
+++ b/Code/autopkg
@@ -200,6 +200,7 @@ def find_recipe_by_name(name, search_dirs):
patterns = [
os.path.join(normalized_dir, "%s.recipe" % name),
os.path.join(normalized_dir, "*/%s.recipe" % name),
+ os.path.join(normalized_dir, "*/*/%s.recipe" % name),
]
@n8felton
n8felton / versioning_semver.sh
Created August 2, 2019 20:12
Semantic version numbers for macOS
# bash
product_version=$(sw_vers -productVersion) # 10.14.6
os_vers=( ${product_version//./ } ) # ( 10 14 6 )
os_vers_major="${os_vers[0]}" # 10
os_vers_minor="${os_vers[1]}" # 14
os_vers_patch="${os_vers[2]}" # 6
os_vers_build=$(sw_vers -buildVersion) # 18G87
echo "${os_vers_major}.${os_vers_minor}.${os_vers_patch}+${os_vers_build}" # 10.14.6+18G87
# zsh
#!/usr/bin/python
# As written, this requires the following:
# - OS X 10.6+ (tested on 10.12.6 and 10.14.3)
# - python 2.6 or 2.7 (for collections.namedtuple usage, should be fine as default python in 10.6 is 2.6)
# - pyObjC (as such, recommended to be used with native OS X python install)
# Run with root
import objc, ctypes.util, os.path, collections
@n8felton
n8felton / deploystudio_api_notes.sh
Created March 23, 2018 12:46
DeployStudio API Notes
# Replace with the username and password of an account that has access to your DeployStudio instances
python -c 'import base64; print "Authorization: Basic %s" % base64.b64encode("USERNAME:PASSWORD")'
# Authorization: Basic VVNFUk5BTUU6UEFTU1dPUkQ=
AUTH="Authorization: Basic VVNFUk5BTUU6UEFTU1dPUkQ="
SERVER="https://localhost:60443"
# Grab the workflows (as a binary plist), convert them to XML, and dump to stdout
curl -sk -X GET \
-H "${AUTH}" \
@n8felton
n8felton / releases.json
Created February 20, 2018 19:30
AutoDesk Releases
{
"releases": [
{
"productname": "autodesk-maya",
"producttitle": "Maya",
"name": "autodesk-maya-2014",
"title": "Maya 2014",
"productlinecode": "",
"productKey": "657F1",
"sku": "657F1-00Z1CC-100N",
@n8felton
n8felton / extract_printer_icon.sh
Last active March 16, 2020 19:22
Small snippet to extract printer icons from macOS printer drivers
MODEL="Xerox WorkCentre 6655"
ICON=$(gunzip -c "/Library/Printers/PPDs/Contents/Resources/${MODEL}.gz" | awk '/APPrinterIconPath/ {gsub(/"/,"",$2); print $2}')
/usr/bin/sips -s format png "${ICON}" --out "${MODEL}.png" --addIcon --resampleHeightWidthMax 512
@n8felton
n8felton / munki_categories.txt
Created August 1, 2017 01:46
Shortened list of munki categories
Configurations
Developer Tools
Drivers
Graphics & Design
Math & Science
Plugins
Printers
Productivity
Utilities