Skip to content

Instantly share code, notes, and snippets.


Andre LaBranche dreness

Block or report user

Report or block dreness

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dreness / pre-commit
Last active Jul 12, 2019
git pre-commit hook to set commit email address based on the repo's remote domain(s)
View pre-commit
# Set repo's to a default or alternate value based on remote domain.
# Because the in-flight commit info has already been set, if an email address
# change is needed, this commit is aborted. Retry the commit to use the new address.
# To automatically install custom hooks to new repos:
# 1) Add something like the following to ~/.gitconfig:
# [init]
# templatedir = ~/.git/templates
dreness / manual-ocsp-check.txt
Created Feb 22, 2016
Manually check certificate revocation status using OCSP
View manual-ocsp-check.txt
# Assumes an Apple-like layout: leaf --> issuer --> CA in exactly 3 certs
# The last arg to codesign specifies the code to check, by bundle or executable path, or process ID
codesign -d -vv --extract-certificates=cert I-didnt-edit-my-config-file
for i in 0 1 2 ; do openssl x509 -inform der -in cert${i} -out cert${i}.pem ; done
openssl ocsp -CAfile cert2.pem -issuer cert1.pem -cert cert0.pem -url $(openssl x509 -in cert0.pem -ocsp_uri -noout)
╭─ andre@flux ~
dreness /
Last active May 26, 2019
Attempt to repair an interrupted QuickTime Player audio recording
#set -e
#set -x
# This script attempts to repair a partial AIFC recording generated by
# QuickTime Player. This happens when QTP is interrupted while recording.
# Look for partial files with:
dreness / Uncloned.swift
Created May 1, 2019
Show something mumble mumble APFS cloned files mumble?
View Uncloned.swift
import Cocoa
func unclonedSize(of url: URL) throws -> off_t {
var list = attrlist(bitmapcount: UInt16(ATTR_BIT_MAP_COUNT),
reserved: 0,
commonattr: 0,
volattr: 0,
dirattr: 0,
fileattr: 0,
dreness /
Created Apr 1, 2019
make a bunch of barcodes
#!/usr/bin/env python3
# make some barcodes, then use ffmpeg to make a video from the individual frames,
# to see how fast FirebaseML can recognize barcodes through the camera.
# barcode types
# code128 code39 ean ean13 ean14 ean8 gs1
# gtin isbn isbn10 isbn13 issn itf jan pzn upc upca
dreness /
Last active Feb 19, 2019
A script to apply bandwidth limits to specific traffic in OS X using pf and dummynet
# Create a file such as /Users/you/Documents/pftable to hold a list of IPs or subnets to throttle.
# Example file contents:
# Reset dummynet to default config
dnctl -f flush
dreness /
Last active Feb 10, 2019
Interrogate LaunchServices to query file paths for default app handler, all possible app handlers, and the UTI
#!/usr/bin/env python
import LaunchServices as ls
from Foundation import NSURL
from sys import argv
for arg in argv[1:]:
url = NSURL.fileURLWithPath_(arg)
if url == None: continue
print("\n", url.path())
dreness /
Last active Jan 6, 2019
Synthesize and host vlc-x-callback stream links
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import os
import socket
from datetime import datetime
from urllib import parse
from klein import Klein
from twisted.web.static import File
from twisted.python.filepath import FilePath
#!/usr/bin/env python3
import json
from beautifulscraper import BeautifulScraper
from pprint import pprint as pp
URL = ""
def seasonClips(URL):
VIDS = []
dreness / mystery_routing.txt
Last active Dec 3, 2018
A routing puzzle for you
View mystery_routing.txt
Question: is there ever a reason to ARP for an IP outside of any local subnets?
Update: I like @bmastenbrook's answer:
# my subnet is a /24, and is totally not on the same /24 as
xomg% netstat -rn -f inet
Routing tables
Destination Gateway Flags Refs Use Netif Expire
default UGScI 3 0 en0
You can’t perform that action at this time.