Skip to content

Instantly share code, notes, and snippets.

Michael Lynn pudquick

Block or report user

Report or block pudquick

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>
# 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
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+
pudquick /
Created Mar 6, 2017
Storing and retrieving a generic password in the login.keychain in macOS via python and pyobjc
import objc
from ctypes import c_char
from Foundation import NSBundle
Security = NSBundle.bundleWithIdentifier_('')
S_functions = [
('SecKeychainGetTypeID', 'I'),
('SecKeychainItemGetTypeID', 'I'),
('SecKeychainAddGenericPassword', 'i^{OpaqueSecKeychainRef=}I*I*I*o^^{OpaqueSecKeychainItemRef}'),
('SecKeychainOpen', 'i*o^^{OpaqueSecKeychainRef}'),

Keybase proof

I hereby claim:

  • I am pudquick on github.
  • I am frogor ( on keybase.
  • I have a public key ASBTy_VUW9m2orm3VyY994_c5qlvSMMatsoKxQk0l6LhyAo

To claim this, I am signing this object:

pudquick /
Created Dec 23, 2015
Programmatically immediately lock the screen of a Mac running OS X, regardless of security settings, screensaver settings, or Fast User Switch settings
from ctypes import CDLL
loginPF = CDLL('/System/Library/PrivateFrameworks/login.framework/Versions/Current/login')
result = loginPF.SACLockScreenImmediate()
pudquick /
Last active Jun 24, 2019
Parsing of bom files in pure python
# 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
pudquick /
Created Nov 20, 2012
pipista - pip module (for installing other modules) for Pythonista
import os, os.path, sys, urllib2, requests
class PyPiError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def _chunk_report(bytes_so_far, chunk_size, total_size):
if (total_size != None):
pudquick /
Created Dec 22, 2016
Querying active SIP status directly from the kernel, bypassing nvram and csrutil, via python on macOS
# An overly complicated SIP config checker
# This is a technically interesting implementation because it does not rely on csrutil
# Instead it queries the kernel directly for the current configuration status
# This means, for example, in environments where SIP has been disabled and csrutil has
# been removed or modified (say, with DYLD_LIBRARY_PATH), as long as python can run you
# can still check status
# Additionally, checking the nvram csr-active-config setting isn't accurate now with
# 10.12.2+, since running "sudo csrutil clear" deletes the variable until reboot,
import sys, os, os.path, tempfile, plistlib, shutil, marshal, subprocess, pickle, textwrap
class TempApp(object):
_skeleton_app = textwrap.dedent("""
import sys, marshal, types, pickle
main_func_marshal = %s
args_pickle = %s
code = marshal.loads(main_func_marshal)
main_func = types.FunctionType(code, globals(), "main_func")
args = dict(pickle.loads(args_pickle))
You can’t perform that action at this time.