Skip to content

Instantly share code, notes, and snippets.

Avatar

soundsnw

View GitHub Profile
View check-if-preview-is-default.sh
#!/bin/sh
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Check if Preview.app is the default PDF reader
loggedInUser=$(scutil <<<"show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }')
if [[ ! $(/usr/bin/sudo -u "$loggedInUser" /usr/local/orgutils/swda getUTIs | grep com.adobe.pdf | grep Preview) ]]; then
echo "<result>No</result>"
else
View check-and-change-pdf-reader.sh
#!/bin/bash
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
#
# Check if Preview.app is the default PDF reader and change it back if it isn't
#
# Get OS version and logged in user
osVersion=$(/usr/bin/sw_vers -productVersion | awk -F. '{print $2}')
@soundsnw
soundsnw / promoteUser.sh
Last active Jan 26, 2020
Catalina compatible Zsh script to promote a standard user to an admin
View promoteUser.sh
#!/bin/zsh
emulate -LR zsh # Reset zsh options
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Simple Zsh tempadmin v0.1
#
# Catalina compatible script for Jamf Self Service to grant standard
# users temporary admin rights.
#
# Modified by soundsnw, original code by Armin Briegel
View create-macos-vmware-image.sh
sudo /usr/local/bin/vfuse -i ~/Downloads/osx-10.14.5-18F132.apfs.dmg --use-qemu /usr/local/Cellar/qemu/4.0.0/bin/qemu-img -n "macOS10.14.5" -s C02X225WJHD3 --hw-model MacBookAir7,2
View org.mozilla.firefox.plist
<?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>EnterprisePoliciesEnabled</key>
<true/>
<key>DisableFeedbackCommands</key>
<true/>
<key>DisableFirefoxAccounts</key>
<true/>
View com.Google.Chrome.plist
<?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>PromotionalTabsEnabled</key>
<false/>
<key>WelcomePageOnOSUpdateEnabled</key>
<false/>
<key>MetricsReportingEnabled</key>
<false/>
View set-timezone-and-network-time-server.sh
#!/bin/bash
# Set time zone and enable network time server
sudo /usr/sbin/systemsetup -setusingnetworktime off
sudo /usr/sbin/systemsetup -settimezone "Europe/London"
sudo /usr/sbin/systemsetup -setnetworktimeserver time.euro.apple.com
View EnableLocationServices.sh
#!/bin/bash
# Enable location services and automatic time zone configuration
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -int 1
uuid=$(/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57)
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.$uuid LocationServicesEnabled -int 1
View gist:381b477e25950c29b305a0f44f73fd5c
#!/bin/bash
# Enable location services and automatic time zone configuration
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -int 1
uuid=$(/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57)
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.$uuid LocationServicesEnabled -int 1
View com.apple.applicationaccess.plist
<?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>allowDiagnosticSubmission</key>
<false/>
</dict>
</plist>
You can’t perform that action at this time.