Skip to content

Instantly share code, notes, and snippets.

@grahamgilbert
grahamgilbert / clean_old_apple_updates.py
Created May 9, 2018 16:35
Clean out old apple updates (older than 24 hours) because softwareupdate often refuses to install them
#!/usr/bin/python
"""
Removes cached apple updates that are older than 24 hours
"""
import datetime
import os
import shutil
import sys
@grahamgilbert
grahamgilbert / profileenforcer.py
Created November 2, 2018 20:57
Profile enforcer. This is an example, no warranty expressed or implied. Use at your own risk.
import sal.plugin
import requests
from django.conf import settings
SETTINGS = settings.PROFILE_SETTINGS
class Profileenforcer(sal.plugin.Widget):
description = 'Enforces profiles via MDM'
select username,uuid,uid,gid,description,directory, case WHEN uuid in (SELECT users.uuid FROM user_groups INNER JOIN users ON user_groups.uid = users.uid WHERE user_groups.gid = 80) THEN "admin" ELSE "standard" END AS user_type from users;

Keybase proof

I hereby claim:

  • I am grahamgilbert on github.
  • I am grahamgilbert (https://keybase.io/grahamgilbert) on keybase.
  • I have a public key ASDdB4_Tt3Pfh7-qvEoOSZCAfoUJoxgTtv8YoyA3MTGHdwo

To claim this, I am signing this object: