Skip to content

Instantly share code, notes, and snippets.

View lucascantor's full-sized avatar

Lucas Cantor lucascantor

View GitHub Profile
@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 / checkGateKeeper.sh
Last active April 26, 2022 07:56
Manage GateKeeper
# check current GateKeeper configuration status
spctl --status
@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 / 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 / authrestart.sh
Last active September 30, 2020 15:11
The fdesetup utility can be used to remotely restart a Mac without needing physical in-person keyboard access to unlock FileVault on the next boot only
fdesetup authrestart
@lucascantor
lucascantor / disablePrinterSharing.sh
Last active April 3, 2020 22:22
Disable printer sharing on all installed printers
lpstat -p | grep printer | awk '{print $2}'| xargs -I{} lpadmin -p {} -o printer-is-shared=false
@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 / enableOwnershipOnExternalDisk.sh
Last active June 2, 2018 17:26
Enable file ownership on an external disk
vsdbutil -a /Volumes/ExternalDiskNameHere
@lucascantor
lucascantor / openUpdates.sh
Last active May 5, 2018 17:43
Open Mac App Store Software Updates Page
/usr/bin/open macappstore://showUpdatesPage