This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import sys | |
from CoreFoundation import (CFPreferencesAppValueIsForced, | |
CFPreferencesCopyAppValue, | |
CFPreferencesCopyValue, | |
kCFPreferencesAnyUser, | |
kCFPreferencesAnyHost, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash-3.2$ /Applications/Install\ macOS\ Sierra.app/Contents/Resources/startosinstall --usage | |
Usage: startosinstall --applicationpath <install macOS.app path> | |
Arguments | |
--applicationpath, a path to copy of the OS installer application to start the install with. | |
--license, prints the user license agreement only. | |
--agreetolicense, agree to license the license you printed with --license. | |
--rebootdelay, how long to delay the reboot at the end of preparing. This delay is in seconds and has a maximum of 300 (5 minutes). | |
--pidtosignal, Specify a PID to which to send SIGUSR1 upon completion of the prepare phase. To bypass "rebootdelay" send SIGUSR1 back to startosinstall. | |
--usage, prints this message. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
CFLAGS= | |
SIGNINGIDENTITY="insert signing identity here" | |
IDENTIFIER=com.someorg.fudo.changeme | |
fudo: main.c | |
$(CC) -o fudo main.c | |
codesign -s $(SIGNINGIDENTITY) -i $(IDENTIFIER) fudo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/munki/munki-python | |
import sys | |
import os | |
from Foundation import NSDate | |
from Foundation import NSPredicate | |
def doComparison(comp_string, obj): | |
print('Comparison: %s' % comp_string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/munki/munki-python | |
'''Demo only. Needs more robust error checking and handling''' | |
import os | |
from Foundation import NSURL, NSURLQuarantinePropertiesKey | |
def getQuarantineAttribute(pathname): | |
'''Returns a dict contaning quarantine info for pathname or None''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on sysctl function by Michael Lynn | |
# https://gist.github.com/pudquick/581a71425439f2cf8f09 | |
from ctypes import CDLL, c_uint, byref, create_string_buffer | |
from ctypes import cast, POINTER, c_int32, c_int64 | |
from ctypes.util import find_library | |
import struct | |
libc = CDLL(find_library('c')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is designed to be run as root, perhaps by a management tool | |
# It takes one argument, a path to an app to be launched (or a name of an app, | |
# if you don't mind LaunchServices deciding which if any app to launch) | |
# | |
# If the current console user is not a member of the admin group, the user will | |
# be added to to the group. The app will then be launched in the console user's | |
# context. | |
# When the app exits (or this script is killed via SIGINT), if we had promoted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Routines for manipulating the Dock''' | |
import os | |
import subprocess | |
from Foundation import NSURL | |
from Foundation import CFPreferencesAppSynchronize | |
from Foundation import CFPreferencesCopyAppValue | |
from Foundation import CFPreferencesSetAppValue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plistlib | |
import CoreFoundation | |
from Foundation import NSDate, NSMutableArray, NSMutableDictionary | |
# read the current ManagedPlugInPolicies | |
policy = CoreFoundation.CFPreferencesCopyAppValue("ManagedPlugInPolicies", "com.apple.Safari") | |
if policy: | |
# policy is an immutable dict, so we have to make a mutable copy | |
my_policy = NSMutableDictionary.alloc().initWithDictionary_copyItems_(policy, True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
'''Uses Cocoa classes via PyObjC to set a random desktop picture on all screens. | |
Tested on Mountain Lion and Mavericks. | |
See: | |
https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWorkspace_Class/Reference/Reference.html | |
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/Reference/Reference.html |
NewerOlder