Skip to content

Instantly share code, notes, and snippets.

@pudquick
pudquick / uninstalld.md
Last active August 29, 2015 14:05
com.apple.uninstalld.uninstall in detail - how to read the authorization.plist / auth.db

A study of the 'com.apple.uninstalld.uninstall' right

From /System/Library/Security/authorization.plist:

<key>com.apple.uninstalld.uninstall</key>
<dict>
    <key>class</key>
    <string>rule</string>
@pudquick
pudquick / pygame.md
Last active August 29, 2015 14:06
Steps to install (most of) pygame cleanly for 10.9

Downloads:

@pudquick
pudquick / cert_tricks.py
Last active August 29, 2015 14:08
SHA-1 PEM cert signature & CN extraction from a certificate via python on OS X
import base64, hashlib
from ctypes import CDLL, POINTER, Structure, create_string_buffer, byref
from ctypes.util import find_library
Security = CDLL(find_library('Security'))
# Importing this via C because haven't figured out how to mix in pyObjc version yet
c_CoreFoundation = CDLL(find_library('CoreFoundation'))
class OpaqueType(Structure):
pass
@pudquick
pudquick / installer.txt
Created October 27, 2014 19:07
Strings on Installer framework
IFJS_IFDContext
IFJS: Package Authoring Error: system.run()/runOnce() require <options allow-external-scripts='yes'/>
IFJS: Path for embedded script %s not available
IFJS: Error while running task %s %s
IFJS: %s: Error getting process info for PSN %d:%d
IFJS: *** exception: %s
IFJS: choices delegate must respond to allChoices and choiceForIdentifier:
IFJS: Package Authoring Error: access to path "%s" requires <options allow-external-scripts='true'>
IFJS: Failed to stat root path %s (%s)
_IFJS_IFDCustomizationItemClassDefinition
@pudquick
pudquick / reg_check.ps1
Created October 31, 2014 00:06
Powershell check a registry key on IPs
$TESTREG = "SOFTWARE\\Adobe\\Adobe ARM\\1.0\\ARM"
$TESTKEY = "iCheck"
$IPS = Get-Content 'C:\Users\yourname\Desktop\ips.txt'
$OUTPUT = 'C:\Users\yourname\Desktop\ips_log.txt'
function GetName($ipaddr) {
# Resolve a computer name if we can
try {
[System.Net.Dns]::GetHostByAddress($ipaddr).HostName
} catch [System.Exception] {
@pudquick
pudquick / lines.py
Last active August 29, 2015 14:09
Uncommon variations on multi-line strings in python
# Variations on a theme.
# This first example uses a poorly documented trick in python regarding strings:
#
# https://docs.python.org/2/tutorial/introduction.html
# "Two or more string literals (i.e. the ones enclosed between quotes) next to each other
# are automatically concatenated."
#
# Then it's combined with the python implied line continuation by wrapping it in an outer
# set of parentheses.
@pudquick
pudquick / menu-tasking-enabler-10.hqx
Created November 19, 2014 02:14
As retrieved from gopher://sdf.org/1/computers/apple/mac/ui/
Date: Tue, 27 Dec 1994 04:52:52 -0500 (EST)
From: "Chris Thomas, ICONtact Developer Database Librarian" <THUNDERONE@delphi.com>
Subject: MenuTasking Enabler 1.0
Menutasking Enabler 1.0
(C) 1994 Chris K. Thomas. All Rights Reserved.
Reach me at <thunderone@delphi.com>
So you're taking a spin around your Mac with an Amiga-using friend of
yours, doing a download in the background and some other stuff in the
@pudquick
pudquick / 00-prison_json.py
Last active August 29, 2015 14:16
Python script for parsing the current (as of this gist) Prison Architect file format
# You need python 2.7 for this
# FYI: There's a filepath hardcoded in this example at the end
# If you've got python installed, you can run this with: python prison_json.py
import re, mmap, collections, json, os
# These are special keys which should be treated as an array/list of values
multi_keys = ["Traits", "Reputation", "ReputationHigh"]
def dequote(keyname):
@pudquick
pudquick / xcrun.py
Created March 3, 2015 21:04
XCode path mangling in python
import struct, hashlib
def hashStringForPath(cls, path):
hash_path = [None] * 28;
md5_digest_hex = hashlib.md5(path).digest();
first_value = struct.unpack('>Q', md5_digest_hex[:8])[0];
second_value = struct.unpack('>Q', md5_digest_hex[8:])[0];
counter = 13;
while counter >= 0: