Skip to content

Instantly share code, notes, and snippets.

Erik Gomez erikng

Block or report user

Report or block erikng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fdsetup-for-crypt.mobileconfig
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>Privacy Preferences Policy Control</string>
erikng /
Created Aug 30, 2019 — forked from pudquick/
locally checking profile signing information
# So the first thing we need to do is get the mdmclient view of the profiles
import subprocess, objc
from Foundation import NSPropertyListSerialization, NSPropertyListMutableContainers, NSBundle
Security = NSBundle.bundleWithIdentifier_('')
S_functions = [
('SecCertificateCreateWithData', '@@@'),
('SecCertificateCopyValues', '@@^@o^@'),
erikng /
Created Aug 20, 2019 — forked from tombigel/
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in's Wayback Machine

Mac OS X

To check the current limits on your Mac OS X system, run:

erikng /
Last active Jun 12, 2019
'''Downloads gists of a specified user on github. Useful if they are say...
joining a fruit company.'''
import json
import optparse
import os
import requests
View chef_user_resource_monkeypatching.rb
require 'base64'
require 'plist'
module Chef::Provider::User::DsclMojaveUserExtensions
# new for 10.14+
def mac_osx_version_greater_than_10_13?['platform_version']) >'10.13.99')
# updated for 10.14+
erikng /
Created Dec 5, 2018 — forked from pudquick/
Send polite Logout / "really" Logout / Restart / Shutdown Apple Events to loginwindow via python and pyObjC
import struct, objc
from Foundation import NSBundle
from Cocoa import NSAppleEventDescriptor
def OSType(s):
# Convert 4 character code into 4 byte integer
return struct.unpack('>I', s)[0]
# Create an opaque pointer type to mask the raw AEDesc pointers we'll throw around
AEDescRef = objc.createOpaquePointerType('AEDescRef', '^{AEDesc=I^^{OpaqueAEDataStorageType}}')
erikng / Privacy Preferences Policy Control
Last active Aug 29, 2019
Privacy Preferences Policy Control
View Privacy Preferences Policy Control

Privacy Preferences Policy Control Payload

The Privacy Preferences payload is designated by specifying value as the PayloadType value.

It controls the settings that are displayed in the ”Privacy” tab of the ”Security & Privacy” pane in System Preferences.

This profile must be delivered via a user approved MDM server.

Availability: Available in macOS 10.14 and later.

In addition to the settings common to all payloads, this payload defines this key:

erikng /
Created Aug 14, 2018
# In order for this to work, you will need to go to System Preferences in Mojave -> Security & Privacy -> Privacy -> Full Disk Access and grant permissions
import sqlite3
conn = sqlite3.connect('/Library/Application Support/')
c = conn.cursor()
query = 'SELECT * FROM access'
allowed_binaries = c.fetchall()
# As written, this requires the following:
# - OS X 10.6+ (may not work in 10.10, haven't tested)
# - python 2.6 or 2.7 (for collections.namedtuple usage, should be fine as default python in 10.6 is 2.6)
# - pyObjC (as such, recommended to be used with native OS X python install)
# Only tested and confirmed to work against 10.9.5
# Run with root
erikng /
Created May 30, 2018 — forked from jessepeterson/
getgrouplist using OS X-specific API
import grp, pwd, os
from ctypes import *
from ctypes.util import find_library
libc = cdll.LoadLibrary(find_library('libc'))
# getgrouplist_2() is an undocumented API which, I beleive, retrives all of
# a user's groups instead of the maximum 16 groups which getgrouplist() gets
You can’t perform that action at this time.