Skip to content

Instantly share code, notes, and snippets.

View RhetTbull's full-sized avatar

Rhet Turnbull RhetTbull

View GitHub Profile
@RhetTbull
RhetTbull / pre-commit.sh
Created September 22, 2021 03:14 — forked from intjonathan/pre-commit.sh
pre-commit hook (add to .git/hooks/pre-commit) to refuse to commit debugger strings
#!/bin/sh
# Refuse to commit files with the string ZZZ present
# I frequently use ZZZ to mark a spot where I'm working on an issue so I can come back to it
#
NOCOMMIT="ZZZ"
files=$(git diff-index --name-status --cached HEAD | grep -v ^D | cut -c3-)
if [ "$files" != "" ]
@RhetTbull
RhetTbull / sqlite.py
Created August 31, 2021 20:16 — forked from michalc/sqlite.py
Use libsqlite3 directly from Python with ctypes: without using the built-in sqlite3 Python package, and without compiling anything
# From https://stackoverflow.com/a/68876046/1319998, which is itself inspired by https://stackoverflow.com/a/68814418/1319998
from contextlib import contextmanager
from collections import namedtuple
from ctypes import cdll, byref, string_at, c_char_p, c_int, c_double, c_int64, c_void_p
from sys import platform
def query(db_file, sql, params=()):
libsqlite3 = cdll.LoadLibrary({'linux': 'libsqlite3.so', 'darwin': 'libsqlite3.dylib'}[platform])
@RhetTbull
RhetTbull / apple-photo-schema.sql
Created May 4, 2020 11:41 — forked from aslakr/apple-photo-schema.sql
sqlite ".schema" dump
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,