Skip to content

Instantly share code, notes, and snippets.

View eahrold's full-sized avatar

Eldon Ahrold eahrold

View GitHub Profile
@eahrold
eahrold / OSXMounter.py
Last active November 21, 2020 16:11 — forked from pudquick/mount_shares.py
Programmatically mount shares in OS X via python without the need for AppleScript
import os
import objc, CoreFoundation
from ctypes import c_void_p, pointer, cast
# The only reason I'm doing this the XML way is because I don't have a better way (yet)
# for correcting a function signature -after- it's already been imported.
# The problem is the last argument is a pointer to a CFArrayRef, which works out to a
# pointer to a pointer to a CFArray. pyobjc doesn't handle that much abstraction, so I created
# a custom opaque type 'CFArrayRefRef' and manually handle the conversion to/from pointer.