Skip to content

Instantly share code, notes, and snippets.

View s-m-e's full-sized avatar
🌍
on planet earth, galactic sector zz plural z alpha

sme s-m-e

🌍
on planet earth, galactic sector zz plural z alpha
View GitHub Profile
@s-m-e
s-m-e / run_routines_on_objects_in_parallel_and_return.py
Last active September 16, 2017 19:38
Multiprocessing pool: How to call an arbitrary list of methods on a list of class objects
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# LIBRARY PART
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
from functools import partial
import multiprocessing
NUM_CORES = multiprocessing.cpu_count()
@s-m-e
s-m-e / svg_text_length.py
Last active July 27, 2021 00:47
A Python (3) class for figuring out the width and height of a formatted svg text.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Loosely based on http://stackoverflow.com/a/28741636/1672565
import subprocess
import struct
import os