Skip to content

Instantly share code, notes, and snippets.

View matthewbodaly's full-sized avatar

Matthew matthewbodaly

View GitHub Profile
#!/bin/sh
#enable logging
defaults write /Library/Preferences/com.apple.MCXDebug debugOutput -2
defaults write /Library/Preferences/com.apple.MCXDebug collateLogs 1
touch /var/db/MDM_EnableDebug
#reset DEP
rm /var/db/.AppleSetupDone
rm -rf /var/db/ConfigurationProfiles/
rm /Library/Keychains/apsd.keychain
# Remove JAMF Framework
@matthewbodaly
matthewbodaly / setupdrive.sh
Created February 5, 2016 06:13
Google Drive doesn't natively support external drives. My initial seed was on an external drive. This script / method isn't perfect as Google Drive did throw a few errors... well more than a few and I had to disconnect / reconnect a few times.
#!/bin/sh
#get current username
currentUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
#do thing
mkdir /Users/$currentUser/Google\ Drive
ln -s /Volumes/DataDrive/Google\ Drive/ /Users/$currentUser/Google\ Drive/
# one version of running the script this way works.... other times, ran into errors
# rm -rf /Users/$currentUser/Google\ Drive/

Keybase proof

I hereby claim:

  • I am matthewbodaly on github.
  • I am thejedi (https://keybase.io/thejedi) on keybase.
  • I have a public key whose fingerprint is 9175 584D B433 DE51 8076 33CD 87C1 B21C D8F2 B98F

To claim this, I am signing this object:

@matthewbodaly
matthewbodaly / gist:947a2db5dccc2aa730fc
Created February 11, 2016 00:09
Needed to uninstall a JDS and didn't feel like typing
#!/bin/sh
launchctl unload /Library/LaunchDaemons/com.jamfsoftware.jamfdspolicy.plist
cp /Library/JDS/conf/.0000_any_443_.conf /Library/Server/Web/Config/apache2/sites/0000_any_443_.conf
rm -r /Library/JDS
rm /Library/LaunchDaemons/com.jamfsoftware.jamfdspolicy.plist
rm /usr/sbin/jamfds
osascript -e 'tell application "System Events" to log out'
pause 90
killall loginwindow
reboot
@matthewbodaly
matthewbodaly / resetspotlight.sh
Created April 29, 2016 21:01
Reset Spotlight. I mean... really. who wants to do this.
#!/bin/bash
# you shouldn't have to do this but.....
rm -rf /Library/Managed\ Preferences/*Spotlight*
rm -rf /Library/Managed\ Preferences/*/*Spotlight*
killall Spotlight
@matthewbodaly
matthewbodaly / SadMDM.sh
Created April 29, 2016 21:08
Reset JAMF MDM ...
#!/bin/bash
# You shouldn't have to do this, but....
jamf removeMdmProfile -verbose -displayJSSTraffic
jamf mdm -verbose -displayJSSTraffic
jamf manage -verbose -displayJSSTraffic
jamf recon -verbose -displayJSSTraffic
@matthewbodaly
matthewbodaly / depdebug.sh
Last active April 5, 2017 19:24
DEP Debugging
#!/bin/bash
# Step 1: Enable the Debug Log
# In Terminal run the following 3 commands:
sudo defaults write /Library/Preferences/com.apple.MCXDebug debugOutput -2
sudo defaults write /Library/Preferences/com.apple.MCXDebug collateLogs 1
sudo touch /var/db/MDM_EnableDebug
# Step 2: Re-enroll the DEP Computer Without Wiping
# In Terminal run the following 4 commands:
sudo rm /var/db/.AppleSetupDone
@matthewbodaly
matthewbodaly / freespace.py
Created May 16, 2016 23:27
Python method of getting freespace
#!/usr/bin/python
import os
st = os.statvfs("/")
print "<result>%0.2f</result>" % (st.f_bavail * st.f_frsize / 1000 / 1000 / 1000)
@matthewbodaly
matthewbodaly / choices.sh
Created May 23, 2016 20:28
pulled from slack. its an idea.
response=$(curl -H "Accept: application/xml" $jssURL/JSSResource/computerextensionattributes/name/Software%20Status --user $userPass)
choices=$(echo $response | /usr/bin/xpath "//popup_choices/choice/text()" )
removeChoices=$(echo $choices | /usr/bin/awk -F '<choice>|</choice>' '{print $2}')
echo
echo $removeChoices
@matthewbodaly
matthewbodaly / autoslack.sh
Created June 3, 2016 21:59
Installs Slack. Thanks Owen.
#!/bin/sh
# Downloads and installs the latest version of Slack for OS X
printf "Slack auto-install script for OS X\n\n"
SLACK_DOWNLOAD_URL="https://slack.com/ssb/download-osx"
SLACK_10_6_DOWNLOAD_URL="https://slack.com/ssb/download-osx-10-6"
SLACK_ZIP_PATH="/tmp/Slack.app.zip"
SLACK_UNZIP_DIRECTORY="/tmp"