Skip to content

Instantly share code, notes, and snippets.

@tobywf
tobywf / config.yml
Created January 29, 2018 02:40
My SVGO configuration file
multipass: true
plugins:
- removeDoctype
- removeXMLProcInst
- removeComments
- removeMetadata
- removeXMLNS
- removeEditorsNSData
- cleanupAttrs
- minifyStyles
@tobywf
tobywf / sbix_extract.py
Created April 6, 2020 04:54
Extract SBIX glyphs from a font
# https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6sbix.html
# requires fonttools lib (`pip install fonttools>=4.7.0`)
import sys
from fontTools.ttLib import TTFont
font = TTFont(sys.argv[1])
sbix = font["sbix"]
max_ppem = max(sbix.strikes.keys())
strike = sbix.strikes[max_ppem]
@tobywf
tobywf / save-gists.py
Created April 7, 2020 03:33
Save all gists from GitHub, including comments
"""
Save all gists from GitHub, including comments.
Requires the PyGithub library (``pip install PyGithub>=1.47``).
Pass a personal access token with the scope "gist" as the first
argument.
This probably won't work for large files (+10MiB), since they aren't
returned by the GitHub API, and must be cloned instead.