Skip to content

Instantly share code, notes, and snippets.

Lucas Cantor lucascantor

Block or report user

Report or block lucascantor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lucascantor
lucascantor / macOS-dark-mode.css
Created May 27, 2019
Add macOS Dark Mode Support to Your Website
View macOS-dark-mode.css
@media (prefers-color-scheme: dark) {
body {
color: #ddd;
background-color: #222;
}
}
@lucascantor
lucascantor / youtube-channels-to-plex.sh
Last active Mar 31, 2019
Youtube Channels to Plex
View youtube-channels-to-plex.sh
#!/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 Mar 25, 2018
Click the "Allow" button in System Preferences > Security & Privacy to whitelist macOS kernel extensions without physical access.
View allowKernelExtension.scpt
tell application "System Events" to click at {750, 450}
@lucascantor
lucascantor / renameByCreationDate.sh
Created Mar 11, 2018
Rename photo files by their creation date using exiftool
View renameByCreationDate.sh
exiftool '-filename<CreateDate' -d %F_%H-%M-%S%%-c.%%le -r /path/to/directory/containing/image/files
@lucascantor
lucascantor / signMobileconfigFiles.md
Last active Feb 10, 2018
Sign configuration profiles to prevent Jamf from modifying them, ensuring only your explicitly configured settings are applied.
View signMobileconfigFiles.md
  • 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 Jan 27, 2018
Generate and apply a standalone macOS password policy, exempting a specified local admin
View applyPasswordPolicy.sh
#!/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 Jan 27, 2018
Reset printing system to factory defaults
View resetPrintingSystem.sh
#!/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 Jan 27, 2018
Remove network config files to reset to factory defaults
View resetNetworkConfig.sh
#!/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"
)
@lucascantor
lucascantor / removeFlashPlayer.sh
Created Jan 27, 2018
Remove standalone Adobe Flash installation
View removeFlashPlayer.sh
#!/bin/bash
to_remove=(
"/Applications/Utilities/Adobe Flash Player Install Manager.app"
"/Library/Internet Plug-Ins/Flash Player.plugin"
"/Library/Internet Plug-Ins/flashplayer.xpt"
"/Library/PreferencePanes/Flash Player.prefPane"
"/Library/Receipts/Adobe Flash Player.pkg"
)
@lucascantor
lucascantor / prohibitPasswordAuthPerUser.sh
Created Jan 27, 2018
Append rules to to sshd_config to prohibit password ssh auth for a specific user
View prohibitPasswordAuthPerUser.sh
echo -e "\n# Prohibit password authentication for administrator user\nMatch User <username>\n\tKbdInteractiveAuthentication no\n\tPasswordAuthentication no" >> /etc/ssh/sshd_config
You can’t perform that action at this time.