Verify Permissions
diskutil verifyPermissions /
Repair Permissions
diskutil repairPermissions /
(* To the extent possible under law, Rob Mayoff has waived all copyright and related or neighboring rights to “AppleScript to make Google Chrome open/reload a URL”. This work is published from: United States. https://creativecommons.org/publicdomain/zero/1.0/ *) | |
tell application "Google Chrome" | |
activate | |
set theUrl to "http://tycho.usno.navy.mil/cgi-bin/timer.pl" | |
if (count every window) = 0 then | |
make new window | |
end if | |
set found to false |
// ================================ | |
// COPrinterPaperSizes.h | |
// ================================ | |
#import <Foundation/Foundation.h> | |
#define PAPER_NAME @"paper_name" | |
#define PAPER_SIZE @"paper_size" | |
@interface COPrinterPaperSizes: NSObject |
#!/usr/bin/python | |
import ctypes, ctypes.util | |
# Import CoreGraphics as a C library, so we can call some private functions | |
c_CoreGraphics = ctypes.CDLL(ctypes.util.find_library('CoreGraphics')) | |
def disable_beam_sync(doDisable): | |
if doDisable: | |
# Disabling beam sync: | |
# 1st: Enable Quartz debug |
import sys | |
from ctypes import CDLL | |
JavaLaunching = CDLL('/System/Library/PrivateFrameworks/JavaLaunching.framework/JavaLaunching') | |
if (JavaLaunching.JLIsRuntimeInstalled() == 0): | |
print "Apple JRE is not installed." | |
sys.exit(1) | |
else: | |
print "Apple JRE is installed." | |
sys.exit(0) |
# Python routines for parsing bom files | |
# | |
# Examples so far: | |
# | |
# dump_bom(filename) - prints diagnostic structure information about bom file (including path list) | |
from ctypes import BigEndianStructure, c_char, c_uint8, c_uint16, c_uint32, sizeof, memmove, addressof | |
class BOMHeader(BigEndianStructure): | |
_pack_ = 1 |
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 code must run as root | |
# We're mixing ObjC and C-style dylibs, so this is really fun | |
# The only reason we're doing this is that the OS is _really really_ picky about trying to do | |
# ANYTHING with the CoreStorage Family Properties CFDictionary that's in-memory EXCEPT for | |
# making a mutable copy of it. | |
# Once we've done that, we can bring it into pyObjC to play nicely with the data. | |
import objc |
# Tested on 10.11 | |
# Assumes your network is in a state to actually do the discovery and that you have | |
# automatic timezone discovery enabled in Date & Time and Location services enabled | |
# (Generally this means wifi enabled on your device and network stack is up) | |
# For enabling location services and auto, check Allister's work here: | |
# https://gist.github.com/arubdesu/b72585771a9f606ad800 | |
from Foundation import NSBundle | |
TZPP = NSBundle.bundleWithPath_("/System/Library/PreferencePanes/DateAndTime.prefPane/Contents/Resources/TimeZone.prefPane") |
➜ ~ sw_vers | |
ProductName: Mac OS X | |
ProductVersion: 10.12.1 | |
BuildVersion: 16B2333a | |
➜ ~ ls -l /System/Library/Filesystems/apfs.fs/Contents/Resources | |
total 2088 | |
-rwxr-xr-x 1 root wheel 349760 22 Sep 03:48 apfs.util | |
-rwxr-xr-x 1 root wheel 352880 22 Sep 03:48 apfs_invert |