Skip to content

Instantly share code, notes, and snippets.

View duolabmeng6's full-sized avatar

多啦b梦 duolabmeng6

View GitHub Profile
@ayyybe
ayyybe / extract-keep-both.py
Last active July 21, 2022 19:33
extract zip keeping permissions & symlinks intact
import zipfile
import os
import stat
def extract_file(zf, info, extract_dir):
out_path = os.path.join(extract_dir, info.filename)
perm = info.external_attr >> 16
if (stat.S_ISLNK(perm)):
src = zf.open(info).read()
@Draknek
Draknek / zip-app.py
Last active March 27, 2024 15:21
Normally if you zip a .app directory on Windows and unzip it on Mac OS X, it won't run. This tool creates a zip file that should have the correct executable flags set to work correctly.
#!/usr/bin/env python3
import os
import sys
import time
import zipfile
startingdir = os.getcwd()
if (len(sys.argv) == 1):
print("Usage: " + os.path.basename(sys.argv[0]) + " path/to/application.app [path/to/output.zip]")