Skip to content

Instantly share code, notes, and snippets.

View fuzzylogiq's full-sized avatar

Ben Goodstein fuzzylogiq

View GitHub Profile
@fuzzylogiq
fuzzylogiq / InstallZeroTier.ps1
Last active July 21, 2023 09:18 — forked from wise-io/InstallZeroTier.ps1
Installs Latest ZeroTier One Client
<#
.SYNOPSIS
Installs ZeroTier
.DESCRIPTION
Install ZeroTier and join/configure ZeroTier network
.EXAMPLE
./ios-InstallZeroTier.ps1
.NOTES
This script will install PowerShell 7 if it is not present.
A UAC prompt will appear during install if -UI is used.
#!/bin/bash
echo Hello World!
@fuzzylogiq
fuzzylogiq / README.md
Last active April 12, 2021 15:38
Jamf PRO Extension Attribute/boolean exit script to ascertain whether Mac is compatible with a Big Sur installer

macOS Big Sur Installer no longer relies on Board IDs/Model IDs to judge compatibility, appears instead to use Board ID for older hardware and the new model codes (which have been around since T2 time IIRC) for M1s

To get the list of boardids/model codes:

  1. hdiutil mount -nobrowse -noverify /path/to/Install macOS Big Sur.app/Contents/SharedSupport/SharedSupport.dmg
  2. python2: cat /Volumes/Shared\ Support/com_apple_MobileAsset_MacSoftwareUpdate/com_apple_MobileAsset_MacSoftwareUpdate.xml | python -c "import sys; import plistlib; p=plistlib.readPlist(sys.stdin); print ' | '.join(p['Assets'][0]['SupportedDeviceModels']) + ' )'"
  3. python3: cat /Volumes/Shared\ Support/com_apple_MobileAsset_MacSoftwareUpdate/com_apple_MobileAsset_MacSoftwareUpdate.xml | python3 -c "import sys; import plistlib; p=plistlib.loads(sys.stdin.buffer.read()); print(' | '.join(p['Assets'][0]['SupportedDeviceModels']) + ' )')"
  4. copy and paste into script case statement
for exe in /Applications/*/Contents/MacOS/*; do file $exe; done | awk 'BEGIN {FS="/"} /\[arm64/ {print $3}'
@font-face {
font-family: "Fura Mono Powerline";
font-weight: 400;
src: url('https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FiraMono/Regular/complete/Fura%20Mono%20Regular%20Nerd%20Font%20Complete.otf?raw=true' format('truetype'));
}
@font-face {
font-family: "Fura Mono Powerline";
font-weight: 500;
src: url('https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/FiraMono/Medium/complete/Fura%20Mono%20Medium%20Nerd%20Font%20Complete.otf?raw=true' format('opentype'));
@fuzzylogiq
fuzzylogiq / FuraMonoPowerline.css
Last active February 29, 2020 23:05
Fura Mono Powerline.css
This file has been truncated, but you can view the full file.
@font-face {
font-family: "Fura Mono Powerline";
font-style: normal;
font-weight: 200;
src: url(data:font/opentype;charset-utf-8;base64,T1RUTwAOAIAAAwBgQ0ZGIAFDZ0wAABosACDSq0ZGVE2B+j+3ACEqmAAAABxHREVGndOwiQAg7NgA
AACIR1BPU4up13UAIPfsAAAyrEdTVUK3jCKiACDtYAAACopPUy8ymCm7SQAAAVAAAABgUGZFZOQa
PKkAISq0AAACSGNtYXC6i8FbAAAJ9AAAEBZoZWFkDEsuOAAAAOwAAAA2aGhlYQg1FQIAAAEkAAAA
JGhtdHhRV1iiACEs/AAAS3xtYXhwEt9QAAAAAUgAAAAGbmFtZdNtio4AAAGwAAAIQ3Bvc3T/uAAy
AAAaDAAAACAAAQAAAAMcaqtzWC1fDzz1AAsD6AAAAADP4Iu2AAAAANkwQv/+Hv4MBfoEKAABAAgA
AgAAAAAAAAABAAAEGv6iAAAF+v4e/YYF+gABAAAAAAAAAAAAAAAAAAAS3wAAUAAS3wAAAAMDBAK8
@fuzzylogiq
fuzzylogiq / search_ea_scripts.sh
Created November 13, 2019 14:08
Search JSS Extension Attribute scripts for keywords (I used this to find if we had any python in there)
#!/bin/bash
#set -x
read -p "Enter the search term: " search_term
while read -r line; do
ea=$(curl -s -u $APIUSER:$APIPASS "$APIURL/computerextensionattributes/id/$line")
echo $ea | xmllint --xpath "/computer_extension_attribute/input_type/type[contains(text(), 'script')]/following-sibling::script/text()" - 2> /dev/null | grep -q "$search_term"
[ $? == 0 ] && echo "Extension attribute with id $line contains $search_term"
done <<< "$(curl -su $APIUSER:$APIPASS $APIURL/computerextensionattributes | xmlstarlet sel -t -v '//computer_extension_attributes/computer_extension_attribute/id' -)"
Being a success as a Mac admin often means automating repetitive tasks, and that can be enhanced by using live data from a web service's Application Programming Interface or API. Popular MDMs from Jamf and VMware and online services such as GitHub provide rich APIs you can leverage to read and manipulate the data they hold. Modern APIs work by accepting authenticated web requests to specially crafted URLs, allowing you to take data from one service and easily use it to update another.
This workshop will give a basic introduction to REST APIs, how you can authenticate to and interact with them from the command line and in scripts, and will cover tools which make using APIs, and your life as a Mac admin, that little bit easier.
#!/bin/bash
#
# FileVaultSetup.sh
#
# Copyright (c) University of Oxford 2017
# Ben Goodstein <ben.goodstein(at)it.ox.ac.uk>
#
# This script is designed to switch on deferred FileVault enablement for the
# currently logged in user, provided they are not one of our known
# admin accounts (to ensure the end user can unlock the disk). It first
@fuzzylogiq
fuzzylogiq / diff_os.py
Last active April 8, 2020 03:22
Shows the differences in paths installed by two different OS X/macOS installers, with optional path(s) to restrict search to
#!/usr/bin/python
# encoding: utf-8
'''
diff_os.py
Shows the differences in file paths installed by two macOS installer apps or esds
Copyright (C) Ben Goodstein 2017
This program is free software: you can redistribute it and/or modify