Skip to content

Instantly share code, notes, and snippets.

View lucascantor's full-sized avatar

Lucas Cantor lucascantor

View GitHub Profile
@lucascantor
lucascantor / ListWorkSpacesUsers
Created January 6, 2021 22:24
List all Amazon WorkSpaces users via CLI
aws workspaces describe-workspaces --region <RegionNameHere> --query 'Workspaces[*].UserName' --profile <ProfileNameHere>
@lucascantor
lucascantor / Safari.mobileconfig
Created October 29, 2020 18:44
macOS config profile to disable auto-opening downloaded files in Safari
<?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>Safari</string>
<key>PayloadIdentifier</key>
@lucascantor
lucascantor / macOS-dark-mode.css
Created May 27, 2019 17:12
Add macOS Dark Mode Support to Your Website
@media (prefers-color-scheme: dark) {
body {
color: #ddd;
background-color: #222;
}
}
@lucascantor
lucascantor / youtube-channels-to-plex.sh
Last active September 3, 2021 03:45
Youtube Channels to Plex
#!/bin/bash
/path/to/youtube-dl --playlist-reverse --download-archive /path/to/download-archive.txt -i -o "%(uploader)s/%(playlist)s/%(playlist)s - S01E%(playlist_index)s - %(title)s [%(id)s].%(ext)s" -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --add-metadata --write-thumbnail --batch-file=/path/to/channel_list.txt
exit 0
@lucascantor
lucascantor / allowKernelExtension.scpt
Created March 25, 2018 18:53
Click the "Allow" button in System Preferences > Security & Privacy to whitelist macOS kernel extensions without physical access.
tell application "System Events" to click at {750, 450}
@lucascantor
lucascantor / renameByCreationDate.sh
Created March 11, 2018 01:20
Rename photo files by their creation date using exiftool
exiftool '-filename<CreateDate' -d %F_%H-%M-%S%%-c.%%le -r /path/to/directory/containing/image/files
@lucascantor
lucascantor / signMobileconfigFiles.md
Last active February 10, 2018 18:19
Sign configuration profiles to prevent Jamf from modifying them, ensuring only your explicitly configured settings are applied.
  • Save a plaintext filename.mobileconfig file that enforces your desired settings
  • Create a self-signed certificate using Keychain Access
    • Certificate Type: Code Signing
  • Sign the plaintext filename.mobileconfig as filename-signed.mobileconfig
    • /usr/bin/security cms -S -N "<Code Signing Certificate Name Here>" -i "filename.mobileconfig" -o "filename-signed.mobileconfig"
  • Click the Upload button on your JSS Configuration Prifiles Page to upload your signed filename-signed.mobileconfig
  • Jamf states the uploaded configuration profile is in read-only mode, because it is signed
  • Use Jamf to scope the configuration profile to your desired Macs
@lucascantor
lucascantor / applyPasswordPolicy.sh
Created January 27, 2018 08:33
Generate and apply a standalone macOS password policy, exempting a specified local admin
#!/bin/sh
##########################################################################################################
## Pupose: Create a pwpolicy XML file based upon variables and options included below.
## Policy is applied and then file gets deleted. Use "sudo pwpolicy -u <user> -getaccountpolicies"
## to see it, and "sudo pwpolicy -u <user> -clearaccountpolicies" to clear it.
##
## Usage: Only edit the variables in the Variable flowerbox below.
## Run as a policy from Casper, or standalone as root.
##
## Tested on: OS X 10.10 and 10.11
@lucascantor
lucascantor / resetPrintingSystem.sh
Created January 27, 2018 08:09
Reset printing system to factory defaults
#!/bin/bash
# Stop CUPS
launchctl stop org.cups.cupsd
# Backup the InstalledPrinters plist
if [ -e "/Library/Printers/InstalledPrinters.plist" ]
then
mv /Library/Printers/InstalledPrinters.plist /Library/Printers/InstalledPrinters.plist.bak
fi
@lucascantor
lucascantor / resetNetworkConfig.sh
Created January 27, 2018 08:06
Remove network config files to reset to factory defaults
#!/bin/bash
to_remove=(
"/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist"
"/Library/Preferences/SystemConfiguration/com.apple.network.identification.plist"
"/Library/Preferences/SystemConfiguration/com.apple.wifi.message-tracer.plist"
"/Library/Preferences/SystemConfiguration/NetworkInterfaces.plist"
"/Library/Preferences/SystemConfiguration/preferences.plist"
)