This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import sys | |
import importlib | |
if __name__ == "__main__": | |
if len(sys.argv) > 1: | |
modname = sys.argv[1] | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os.path | |
import os | |
import sys | |
import subprocess | |
def write_to_clipboard(output): | |
process = subprocess.Popen( | |
'pbcopy', env={'LANG': 'en_US.UTF-8'}, stdin=subprocess.PIPE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
import traceback | |
import json | |
import sys | |
import os.path | |
class JSONDict(collections.UserDict): | |
def __init__(self, file_name, autosave=False, default=None, data=None): | |
if file_name == None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pathlib | |
import subprocess | |
import osxmetadata | |
def copyfile_with_osx_metadata(src, dest, overwrite_dest=False, findercomments=False): | |
""" copy file from src (source) to dest (destination) """ | |
""" src is path with filename, dest is path only """ | |
""" if overwrite_dest = False (default), will create dest file in form 'filename (1).ext', """ | |
""" 'filename (2).ext', and so on if dest file already exists""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Use Apple PhotoKit via PyObjC bridge to download and save a photo | |
from users's Photos Library | |
Copyright Rhet Turnbull, 2020. Released under MIT License. | |
Required pyobjc >= 6.2 see: https://pypi.org/project/pyobjc/ """ | |
import platform | |
import logging | |
import sys | |
import CoreServices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from types import SimpleNamespace | |
class FreezableRecord(SimpleNamespace): | |
""" A simple namespace record class that allows attributes to be made immutable (frozen) after creation | |
Must be initialized with allowed attributes at creation via **kwargs | |
Behaves somewhat like a namedtuple in that once initialized, new attributes are not permitted, | |
however, unlike a nametuple, attribute values are mutable (unless frozen) | |
Attempt to set a new attribute after initialization will raise AttributeError """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE ZADDITIONALASSETATTRIBUTES ( | |
Z_PK INTEGER PRIMARY KEY, Z_ENT INTEGER, | |
Z_OPT INTEGER, ZALLOWEDFORANALYSIS INTEGER, | |
ZCAMERACAPTUREDEVICE INTEGER, ZCLOUDAVALANCHEPICKTYPE INTEGER, | |
ZCLOUDGROUPINGSTATE INTEGER, ZCLOUDKINDSUBTYPE INTEGER, | |
ZCLOUDRECOVERYSTATE INTEGER, ZCLOUDSTATERECOVERYATTEMPTSCOUNT INTEGER, | |
ZDESTINATIONASSETCOPYSTATE INTEGER, | |
ZEMBEDDEDTHUMBNAILHEIGHT INTEGER, | |
ZEMBEDDEDTHUMBNAILLENGTH INTEGER, | |
ZEMBEDDEDTHUMBNAILOFFSET INTEGER, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE VIRTUAL TABLE RidList_VirtualReader using RidList_VirtualReaderModule; | |
CREATE VIRTUAL TABLE Array_VirtualReader using Array_VirtualReaderModule; | |
CREATE TABLE LiGlobals (modelId integer primary key, keyPath varchar, value varchar, blobValue blob); | |
CREATE INDEX LiGlobals_keyPath_index on LiGlobals(keyPath); | |
CREATE VIRTUAL TABLE LiGlobals_VirtualBufferReader using VirtualBufferReaderModule; | |
CREATE TABLE LiLibHistory (modelId integer primary key, modDate timestamp, eventType varchar, metaSchemaVersion integer, libraryVersion integer, comment varchar); | |
CREATE INDEX LiLibHistory_eventType_index on LiLibHistory(eventType); | |
CREATE VIRTUAL TABLE LiLibHistory_VirtualBufferReader using VirtualBufferReaderModule; | |
CREATE TABLE LiStringAtom (modelId integer primary key, string varchar); | |
CREATE INDEX LiStringAtom_string_index on LiStringAtom(string); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE LiGlobals (modelId integer primary key, keyPath varchar, value varchar, blobValue blob); | |
CREATE TABLE LiLibHistory (modelId integer primary key, modDate timestamp, eventType varchar, metaSchemaVersion integer, libraryVersion integer, comment varchar); | |
CREATE TABLE LiStringAtom (modelId integer primary key, string varchar); | |
CREATE TABLE LiTableDef (modelId integer primary key, tableName varchar, databaseName varchar, digest varchar, ridIndexField varchar, tableOptions integer); | |
CREATE TABLE LiPropertyDef (modelId integer primary key, keyPath varchar, tableId integer, propertyType integer, storage integer, desiredStorage integer, options integer); | |
CREATE TABLE LiPropertyHistory (modelId integer primary key, tableId integer, modDate timestamp, originatingClient integer, changeId integer, keyPathList blob, changeType integer, memo varchar, reason integer, changeIdList blob); | |
CREATE TABLE RKAdjustmentData (modelId integer primary key autoincrement, uuid varchar, versionId integer, data blob, originato |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Find all photos in Apple photos with a detected face and | |
add them to a new album named """ | |
import osxphotos | |
# there's more than one applescript package on pypi | |
# the one you need is py-applescript: | |
# pip install py-applescript | |
from applescript import AppleScript |
OlderNewer