Important
This guide has moved to Google Docs.
❯ python | |
Python 3.10.7 (main, Sep 7 2022, 12:19:18) [GCC 10.2.1 20210110] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> try: | |
... exit() | |
... except SystemExit: | |
... print("no exit for you") | |
... finally: | |
... print("cleanup") | |
... |
from __future__ import annotations | |
import argparse | |
import os | |
import subprocess | |
from pathlib import Path | |
def strip_cc(file: Path | os.PathLike[str]) -> None: | |
""" |
def get_chapters(self, title): | |
milestones = [] | |
for type_, type_milestones in title.service_data.get("milestone").items(): | |
for milestone in type_milestones: | |
milestones.append((type_, milestone)) | |
if not milestones: | |
return [] | |
types = { | |
# https://github.com/IMFTool/IMFTool/blob/master/src/ImfCommon.cpp#L458-L504 |
#!/bin/sh -e | |
step() { | |
for i in $(seq "$1" -1 1); do | |
printf '\r\e[1;36m%s (%d) ' "$2" "$i" | |
sleep 1 | |
done | |
printf '\r\e[0m%s (0)\n' "$2" | |
} |
import re | |
def fstring(s): | |
"""Parse f-string expressions and return the formatted version. | |
This lets you replace f'...' with fstring('...') and have it work on Python versions older than 3.6. | |
Note that this is just a fun project rather than a serious one, and may not be perfect, but feel free to use it. | |
Example: |
Important
This guide has moved to Google Docs.
FROM alpine AS base | |
ENV CONF_ARGS="--disable-shared" \ | |
CMAKE_ARGS="-DBUILD_SHARED_LIBS=0" \ | |
CC="clang-15" \ | |
CXX="clang++-15" \ | |
LD="ld.lld" \ | |
LDFLAGS="-no-pie -static -static-libgcc -Wl,--no-dynamic-linker -Wl,-static" | |
RUN apk add --no-cache autoconf automake ca-certificates clang15 cmake eudev-dev gcc git gnupg libtool linux-headers make musl-dev ncurses-static ncurses-terminfo nghttp2-dev nghttp2-static openssl-dev openssl-libs-static pkgconf wget xz zlib-dev zlib-static | |
FROM base AS libplist |
#!/bin/zsh | |
set -e; | |
incr=false; | |
if [ "$1" = '-i' ]; then | |
incr=true; | |
shift; | |
fi; |
#!/bin/bash -e | |
echo '[+] Installing dependencies from apt' | |
sudo apt-get -y update | |
sudo apt-get -y install --no-install-recommends autoconf autogen automake g++ gcc git libc6-dev libcurl4-openssl-dev libreadline-dev libssl-dev libtool libudev-dev libzip-dev m4 make pkg-config python3-dev zlib1g-dev | |
tmpdir=$(mktemp -d) | |
pushd "$tmpdir" &>/dev/null | |
for lib in libusb/libusb libimobiledevice/libirecovery libimobiledevice/libplist tihmstar/libgeneral tihmstar/libfragmentzip DanTheMann15/tsschecker; do |