This file contains hidden or 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
% python | |
Python 2.7.6 (default, Sep 9 2014, 15:04:36) | |
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> os_vers_1 = "10.9.5" | |
>>> os_vers_2 = "10.10" | |
>>> os_vers_2 > os_vers_1 | |
False | |
>>> from distutils import version | |
>>> version.LooseVersion(os_vers_2) > version.LooseVersion(os_vers_1) |
This file contains hidden or 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
See https://github.com/project-imas/mdm-server#setup for starting point. | |
Assuming you have virtualenv installed.... | |
bash-3.2$ virtualenv mdm-server-env | |
New python executable in mdm-server-env/bin/python | |
Installing setuptools, pip...cd mdone. | |
bash-3.2$ cd mdm-server-env/ | |
bash-3.2$ source bin/activate | |
(mdm-server-env)bash-3.2$ easy_install web.py |
This file contains hidden or 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
% curl -s http://www.getmacapps.com/raw/3 | |
#!/bin/bash | |
mkdir ~/getmacapps_temp | |
cd ~/getmacapps_temp | |
# Installing Chrome | |
curl -L -O "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg" | |
hdiutil mount -nobrowse googlechrome.dmg | |
cp -R "/Volumes/Google Chrome/Google Chrome.app" /Applications |
This file contains hidden or 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 | |
# encoding: utf-8 | |
# | |
# Copyright 2009-2016 Greg Neagle. | |
# | |
# Licensed under the Apache License, Version 2.0 (the 'License'); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
This file contains hidden or 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 hidden or 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 time | |
from Quartz import CGGetActiveDisplayList, CGGetOnlineDisplayList | |
from CoreFoundation import CFPreferencesCopyAppValue | |
def displayMirroringActive(): | |
'''Returns True if any two displays are mirroring, False otherwise''' |
This file contains hidden or 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 hidden or 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 pwd | |
from Foundation import CFPreferencesAppSynchronize | |
from Foundation import CFPreferencesSetValue | |
from Foundation import kCFPreferencesCurrentUser | |
from Foundation import kCFPreferencesCurrentHost |
This file contains hidden or 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 hidden or 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
from Foundation import NSObject, NSUserDefaults, NSKeyValueObservingOptionNew | |
from Foundation import NSRunLoop, NSDate | |
class PrefsObserver(NSObject): | |
def observe(self, domain, key): | |
self.domain = domain | |
self.key = key | |
if self: | |
self.defaults = NSUserDefaults.alloc().initWithSuiteName_( |