from Crypto.Cipher import AES
from Crypto.Util import Counter
import struct
typedef struct boot_dat_hdr
unsigned char ident[0x10];
unsigned char sha2_s2[0x20];
unsigned int s2_dst;
import objc
from ctypes import create_string_buffer, c_void_p, cast
from Foundation import NSBundle
Security = NSBundle.bundleWithIdentifier_('')
# CMSDecoder.h
kCMSSignerUnsigned = 0
kCMSSignerValid = 1
kCMSSignerNeedsDetachedContent = 2
# Warning - because of how this works, it loads classes into memory namespace.
# Attempting to load a second Xcode to inspect within the same python run will result in errors
# If you need to inspect multiple, for now, just spin the inspection up under a second process
from Foundation import NSBundle
def xcode_info(app_path):
# app_path = '/Applications/'
DVTFoundation = NSBundle.bundleWithPath_('%s/Contents/SharedFrameworks/DVTFoundation.framework' % app_path)
IDEKit = NSBundle.bundleWithPath_('%s/Contents/Frameworks/IDEKit.framework' % app_path)
import glob, os.path, pwd, os
from ctypes import CDLL, byref, create_string_buffer, c_uint32
from ctypes.util import find_library
libsys = CDLL(find_library('C'))
def user_temp_dir(uid):
path_buffer = create_string_buffer(1024)
result = libsys.__user_local_dirname(c_uint32(uid), 0, byref(path_buffer), 1024)
return path_buffer.value.rsplit('/0/',1)[0]
View Example.scpt
property destination_for_dmgs : "/Users/mike/Desktop"
on open the_items
repeat with an_item in the_items
set the_info to info for an_item
if kind of the_info is "Folder" then
set dmg_path to quoted form of (destination_for_dmgs & "/" & (name of the_info) & ".dmg")
set src_path to quoted form of POSIX path of an_item
set vol_name to quoted form of (name of the_info)
set command_str to "hdiutil create " & dmg_path & " -volname " & vol_name & " -srcfolder " & src_path
from nibbler import *
from Foundation import NSTimer, NSObject
from AppKit import NSApplication
n = Nibbler('/Users/frogor/Desktop/sweet.nib')
def test2():
print "hi (politely quit)"
from Foundation import NSZeroRect, NSMakeRect, NSMakeSize
from AppKit import NSPNGFileType, NSCompositeCopy, NSGraphicsContext, NSCalibratedRGBColorSpace, NSBitmapImageRep, NSImage, NSImageNameComputer
dimension = 512
size = NSMakeSize(dimension, dimension)
rect = NSMakeRect(0, 0, dimension, dimension)
image = NSImage.imageNamed_(NSImageNameComputer)
# hax hax hax hax hax
import ctypes, os, sys
newstderr = os.dup(2) # This is to mute dyld LC_RPATH warnings
os.dup2('/dev/null', os.O_WRONLY), 2) # because we're loading Xcode frameworks from python
CM = ctypes.CDLL('/Applications/')
sys.stderr = os.fdopen(newstderr, 'w') # This restores stderr
cmark_markdown_to_html = CM.cmark_markdown_to_html
cmark_markdown_to_html.restype = ctypes.c_char_p
View msqq.rb
# Lightweight library to access the System V message queue functionality on Mac OS X (32 and 64 bit)
# Still quite scrappy and needs to be packaged up properly but.. it works!
require 'fiddle'
class MsgQ
LIBC = DL.dlopen('libc.dylib')
IPC_CREAT = 001000
IPC_EXCL = 002000
from Foundation import NSWorkspace, NSURL
import urllib
def show_gists():
def search_gists(search_string):
NSWorkspace.sharedWorkspace().openURL_(NSURL.URLWithString_('' % search_string))