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
import objc | |
from Foundation import NSBundle | |
# Predefine some opaque types | |
DASessionRef = objc.createOpaquePointerType('DASessionRef', b'^{__DASession=}', None) | |
DADiskRef = objc.createOpaquePointerType('DADiskRef', b'^{__DADisk=}', None) | |
# Load DiskManagement framework classes | |
DiskManagment = objc.loadBundle('DiskManagment', globals(), bundle_path='/System/Library/PrivateFrameworks/DiskManagement.framework') |
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
# OFFICIAL REPO: https://github.com/pudquick/nibbler | |
# (this gist will be preserved for historical purposes) | |
# demo video here: | |
# https://www.dropbox.com/s/k0bpekd13muknmz/nibbler%20-%20by%20frogor.mp4?dl=0 | |
# Example script using nibbler: | |
# from nibbler import * | |
# |
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
# This is how I ensure a Python script is launched as root, and automatically | |
# call 'sudo' to re-launch it as root if not. | |
# I found it useful to check the parameters are valid *before* re-launching as | |
# root, so I don’t have to enter the sudo password if there is a problem with | |
# the parameters, or I just want the help message. | |
import os | |
import sys |
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
import objc | |
from Foundation import NSBundle | |
IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit') | |
functions = [("IOServiceGetMatchingService", b"II@"), | |
("IOServiceMatching", b"@*"), | |
("IORegistryEntryCreateCFProperty", b"@I@@I"), | |
] |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>PayloadContent</key> | |
<array> | |
<dict> | |
<key>PayloadType</key> | |
<string>com.apple.applicationaccess.new</string> | |
<key>PayloadVersion</key> |
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
#!/bin/bash | |
# ¯\_(ツ)_/¯ | |
REMOVE_PATHS=( "/Applications/Microsoft Office 2011/" \ | |
"/Library/Preferences/com.microsoft.office.licensing.plist" \ | |
"/Library/LaunchDaemons/com.microsoft.office.licensing.helper.plist" \ | |
"/Library/PrivlegedHelperTools/com.microsoft.office.licensing.helper" \ | |
#"/Users/*/Library/Application Support/Microsoft/Office/" \ | |
#"/Users/*/Library/Preferences/com.microsoft*" \ | |
#"/Users/*/Library/Preferences/ByHost/com.microsoft*" \ |
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
#!/bin/bash | |
# change the values below to match your system. | |
# target the BUILD_DIR to output from an nw.io build process. nwjs-shell-builder recommended! | |
# https://github.com/Gisto/nwjs-shell-builder | |
# BASE_DIR is the target directory for this script, where files will be gathered and packaged to | |
BUILD_DIR=”/var/www/deploy/TMP/osx-ia32/latest-git” | |
BASE_DIR=”/var/www/deploy/osx” |
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/env python | |
from LaunchServices import LSSetDefaultHandlerForURLScheme | |
from LaunchServices import LSSetDefaultRoleHandlerForContentType | |
# 0x00000002 = kLSRolesViewer | |
# see https://developer.apple.com/library/mac/#documentation/Carbon/Reference/LaunchServicesReference/Reference/reference.html#//apple_ref/c/tdef/LSRolesMask | |
LSSetDefaultRoleHandlerForContentType("public.html", 0x00000002, "com.operasoftware.operanext") | |
LSSetDefaultRoleHandlerForContentType("public.xhtml", 0x00000002, "com.operasoftware.operanext") | |
LSSetDefaultHandlerForURLScheme("http", "com.operasoftware.operanext") | |
LSSetDefaultHandlerForURLScheme("https", "com.operasoftware.operanext") |