Skip to content

Instantly share code, notes, and snippets.

View mike-hearn's full-sized avatar

Mike Hearn mike-hearn

View GitHub Profile
@dbrookman
dbrookman / build-mpv_silicon.sh
Last active November 14, 2024 05:30
How to build mpv & mpv.app on an Apple silicon Mac
#!/usr/bin/env bash
# Builds mpv & mpv.app on Apple silicon Macs.
# Run this script from the root directory of the mpv repo.
# if anything fails, gtfo
set -ex
meson setup build
meson compile -C build
@TauPan
TauPan / conftest.py
Last active July 18, 2018 13:31 — forked from asfaltboy/conftest.py
A pytest fixture to test Django data migrations
# based on https://gist.github.com/asfaltboy/b3e6f9b5d95af8ba2cc46f2ba6eae5e2
# based on https://gist.github.com/blueyed/4fb0a807104551f103e6
from django.db import connection
from django.db.migrations.executor import MigrationExecutor
from django.core.management import call_command
import pytest
@jacobian
jacobian / elem2dict.py
Created January 25, 2011 20:22
Convert an lxml.etree node tree into a dict.
def elem2dict(node):
"""
Convert an lxml.etree node tree into a dict.
"""
d = {}
for e in node.iterchildren():
key = e.tag.split('}')[1] if '}' in e.tag else e.tag
value = e.text if e.text else elem2dict(e)
d[key] = value
return d