Skip to content

Instantly share code, notes, and snippets.

@codeman38
codeman38 / gb_logo.py
Created February 20, 2022 16:13
Decode and display the boot logo in a Game Boy ROM
#!/usr/bin/python3
# Reads the Nintendo logo from a Game Boy ROM,
# pairs up 32-bit DWORDs from each half of the logo,
# pairs up nibbles from each half of the DWORD,
# then outputs the decoded logo as a readable bitmap.
#
# codeman38
# original script coded 8 June 2010
# revised 3 July 2011
@codeman38
codeman38 / make_source_sans_alt.sh
Last active February 8, 2021 04:14
Script to create alternate versions of Source Sans fonts with consistent 2-story 'a' and 1-story 'g'
#!/bin/bash
mkdir -p TTF_alt
for fn in TTF/*.ttf; do
feat=ss04
if [[ $fn == *It.ttf ]] || [[ $fn == *Italic.ttf ]]; then
feat=ss03
fi
pyftfeatfreeze -S -U 'Alt' -f $feat $fn TTF_alt/$(basename $fn | sed 's/-/-Alt-/')
done
@codeman38
codeman38 / tumblr-disable-logo-animation.userstyle.css
Last active June 29, 2017 03:36
Userstyle to disable CPU-intensive Tumblr logo animation when invisible
@-moz-document domain(tumblr.com) {
.logo .preload-container:not(:hover) {
animation: none;
}
}
@codeman38
codeman38 / sixpair.c
Last active November 12, 2019 13:23
sixpair.c with support for DualShock 4 model ZCT2U
/*
* sixpair.c version 2007-04-18
* Modified to run on Mac OSX by
* Erlend Cleveland 2011-09-04
* Modified to support DualShock 4 revision 2 (ZCT2U) by
* Cody 'codeman38' Boisclair 2017-06-11
*
* Compile with: gcc -o sixpair sixpair.c -lusb
*/
@codeman38
codeman38 / glyphs_by_width.py
Last active November 30, 2016 16:36
Python script which uses fonttools to output a table grouping glyphs in a font by their advance width.
import argparse
import collections
from fontTools.ttLib import TTFont
__author__="Cody 'codeman38' Boisclair"
def main():
parser = argparse.ArgumentParser(
description="Group glyphs in a font by their advance width.")
parser.add_argument('font', help='font file to parse')
@codeman38
codeman38 / roboto_name_fix.py
Created June 26, 2014 14:54
Fix Windows compatible naming in Roboto font weights
#!/usr/bin/env python2.7
"""Update the 'name' table in the extra Roboto weights to be
more compatible with Windows' font chooser."""
__author__="codeman38"
import argparse
import glob
import os
from fontTools import ttLib
@codeman38
codeman38 / RobotoWinName.diff
Created July 22, 2013 13:50
Patch to run on TTX decompiled versions of Roboto fonts from Google Fonts repository to restore old font family names for Windows.
diff -r 8096c5120604 -r befa039086cd Roboto-Black.ttx
--- a/Roboto-Black.ttx Tue Jul 16 11:13:58 2013 -0400
+++ b/Roboto-Black.ttx Tue Jul 16 11:16:48 2013 -0400
@@ -60467,10 +60467,10 @@
Font data copyright Google 2012
</namerecord>
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
- Roboto
+ Roboto Bk
</namerecord>
@codeman38
codeman38 / zvbi-ntsc-cc-rawnull.patch
Created April 3, 2013 02:57
Adds option to ZVBI ntsc-cc.c to output null frames in raw closed caption dump. This allows timing of captions to be correctly preserved.
diff --git a/contrib/ntsc-cc.c b/contrib/ntsc-cc.c
index 066ef07..9a06ef5 100644
--- a/contrib/ntsc-cc.c
+++ b/contrib/ntsc-cc.c
@@ -124,6 +124,7 @@ char usesen=0;
char debugwin=0;
char test=0;
char usewebtv=1;
+char rawnull=0;
@codeman38
codeman38 / 360Controller.buttonorder.patch
Created October 9, 2011 19:43
Mac Xbox 360 Controller driver: Patches for various bugs
diff -ru 360ControllerSource.orig/360Controller/xbox360hid.h 360ControllerSource/360Controller/xbox360hid.h
--- 360ControllerSource.orig/360Controller/xbox360hid.h 2007-04-21 14:37:27.000000000 -0400
+++ 360ControllerSource/360Controller/xbox360hid.h 2011-10-09 15:41:16.000000000 -0400
@@ -58,10 +58,10 @@
0x45, 0x01, // PHYSICAL_MAXIMUM (1)
0x95, 0x04, // REPORT_COUNT (4)
0x05, 0x09, // USAGE_PAGE (Button)
+ 0x09, 0x08, // USAGE (Button 8)
+ 0x09, 0x07, // USAGE (Button 7)
0x09, 0x09, // USAGE (Button 9)
@codeman38
codeman38 / 360Controller.deadlock.patch
Created October 9, 2011 04:35
Patch to fix deadlock issues in Xbox 360 Controller Driver v.0.10 for Mac OS X
diff -ru 360ControllerSource.0.10/360Controller/_60Controller.cpp 360ControllerSource.0.10a/360Controller/_60Controller.cpp
--- 360ControllerSource.0.10/360Controller/_60Controller.cpp 2011-06-16 13:21:00.000000000 -0400
+++ 360ControllerSource.0.10a/360Controller/_60Controller.cpp 2011-10-09 00:18:14.000000000 -0400
@@ -1,6 +1,7 @@
/*
MICE Xbox 360 Controller driver for Mac OS X
Copyright (C) 2006-2007 Colin Munro
+ Bug fixes contributed by Cody "codeman38" Boisclair
_60Controller.cpp - main source of the driver