Skip to content

Instantly share code, notes, and snippets.

@scriptingosx
scriptingosx / setComputerName.sh
Created May 23, 2024 05:47
Sample script to set the computer name according to my 2024 MacAD.UK presentation: https://scriptingosx.com/macaduk2024
#!/bin/bash
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
####################################################################################################
# License information
####################################################################################################
#
# Copyright (c) 2024, JAMF Software, LLC. All rights reserved.
#
@talkingmoose
talkingmoose / Download and Install Microsoft product.zsh
Last active March 10, 2025 23:07
**Download the latest version of this script from: https://gist.github.com/b6637160b65b751824943ede022daa17 .** Downloads and installs the latest available Microsoft product specified directly on the client. This avoids having to manually download and store an up-to-date installer on a distribution server every month.
#!/bin/zsh
:<<'ABOUT_THIS_SCRIPT'
-----------------------------------------------------------------------
Written by:William Smith
Partner Program Manager
Jamf
[email protected]
https://gist.github.com/b6637160b65b751824943ede022daa17
@bruienne
bruienne / logoutwatcher.sh
Last active July 26, 2023 21:58
logout watcher
onLogout() {
# Insert whatever script you need to run at logout
exit
}
echo "INFO - Watching ${HOME}" >> /var/log/org.my.log
trap 'onLogout' SIGINT SIGHUP SIGTERM
while true; do
@bruienne
bruienne / org.my.logoutwatcher.plist
Last active November 3, 2023 23:04
logout watcher LA
<?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>Label</key>
<string>org.my.logoutwatcher</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/myorg/logoutwatcher.sh</string>
</array>
@rtrouton
rtrouton / gist:8016797
Last active September 28, 2023 12:54
createmyguest.sh script, original by nbalonso (https://gist.github.com/nbalonso/5696340)
#!/bin/bash
# Original script by Noel B. Alonso: https://gist.github.com/nbalonso/5696340
#variables
DSCL="/usr/bin/dscl"
SECURITY="/usr/bin/security"
LOGGER="/usr/bin/logger"
# Determine OS version
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active April 3, 2025 13:20
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx