Skip to content

Instantly share code, notes, and snippets.

View wegotoeleven's full-sized avatar
🥶
TCOB

Stephen Warneford-Bygrave wegotoeleven

🥶
TCOB
View GitHub Profile
@wegotoeleven
wegotoeleven / showOpenConnections.sh
Last active August 5, 2022 19:12
Show open connections
# Show connections
netstat -tn 2>/dev/null | grep :8443 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head
# Show routing table
netstat -nr
# Show all connections
netstat -na
@wegotoeleven
wegotoeleven / globalPreferences.sh
Last active August 5, 2022 19:19
Global Preferences
# Show all
defaults domains | tr ',' '\n'
# Global prefs
$(defaults read -g AppleLocale)
# is the same as
$(defaults read .GlobalPreferences AppleLocale)
# is the same as
@wegotoeleven
wegotoeleven / installMacPorts.sh
Last active August 5, 2022 19:55
Install MacPorts
# Download
https://www.macports.org/install.php
# Uncompress
tar xjvf MacPorts-2.7.2.tar.bz2
# Install
cd MacPorts-2.7.2
./configure --prefix=${HOME}/.macports --with-install-user=${USER} --with-install-group=staff
make && make install
@wegotoeleven
wegotoeleven / jamfProMySQLCommands.sh
Last active August 5, 2022 21:24
Jamf Pro MySQL commands
# Find failed commands
select count(*) from mobile_device_management_commands where apns_result_status='Error';
# Find failed VPP commands
select count(*) from mobile_device_management_commands where command='InstallApplication' and apns_result_status='Error';
# Show devices with failed commands
select device_id from mobile_device_management_commands where apns_result_status='Error';
# Show devices with failed VPP commands
@wegotoeleven
wegotoeleven / getConnectedWifi.sh
Last active August 5, 2022 21:24
Get connected WiFi
# Check connected wifi
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep SSID
@wegotoeleven
wegotoeleven / finAuthdbPreferences.sh
Last active August 5, 2022 21:26
Find Auth.db preferences
# Interrogate the auth.db for System Preference permissions
sudo sqlite3 /var/db/auth.db .dump | grep -i system.preferences | awk -F "'" '{print $2}' | grep system
@wegotoeleven
wegotoeleven / installerChoiceChanges.sh
Last active August 5, 2022 21:26
Installer Choice Changes
# Show available choice changes for a specific package
installer -showChoiceChangesXML -pkg /path/to/the/package.pkg | grep -A 3 -B 4 'selected' | grep -v '\-\-'
@wegotoeleven
wegotoeleven / createCertificateBundle.sh
Last active August 5, 2022 21:28
Create certificate bundle
# Create certificate bundle with private key and cert, and intermediate certs
openssl pkcs12 -export -out <certBundle>.pfx -inkey <privateKey>.key -in <serverCert>.crt -certfile <intermediateCert>.crt
@wegotoeleven
wegotoeleven / resetDEPCache.sh
Created August 5, 2022 21:31
Reset DEP cache
# On Macs without a T2 chip, boot into Single User Mode using cmd-S.
# On Macs with or without a T2 chip, boot into Recovery Mode using cmd-R and open Utilities > Terminal.
# Doesn't work on macOS 11 and newer
mount -uw /System/Volumes/Data
touch /var/db/.RunLanguageChooserToo
mount -uw /
touch /Volumes/Macintosh\ HD/var/db/.RunLanguageChooserToo
@wegotoeleven
wegotoeleven / turnOffSpotlight.sh
Created August 5, 2022 21:32
Turn off Spotlight
# Toggle Spotlight
sudo mdutil -a -i off # Off
sudo mdutil -a -i on # On
# To remove the menu bar icon, run this Terminal command:
sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search && killall SystemUIServer