Skip to content

Instantly share code, notes, and snippets.

Hector Martin marcan

Block or report user

Report or block marcan

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
marcan / glibc-2.29-reiwa.patch
Created Apr 1, 2019
glibc-2.29 patch to add the Reiwa (令和) era
View glibc-2.29-reiwa.patch
--- glibc-2.29/localedata/locales/ja_JP.old 2019-04-01 17:26:52.808154026 +0900
+++ glibc-2.29/localedata/locales/ja_JP 2019-04-01 17:38:48.872822551 +0900
@@ -14946,7 +14946,9 @@
t_fmt_ampm "%p%I<U6642>%M<U5206>%S<U79D2>"
-era "+:2:1990//01//01:+*:<U5E73><U6210>:%EC%Ey<U5E74>";/
+era "+:2:2020//01//01:+*:<U4EE4><U548C>:%EC%Ey<U5E74>";/
+ "+:1:2019//05//01:2019//12//31:<U4EE4><U548C>:%EC<U5143><U5E74>";/
+ "+:2:1990//01//01:2019//04//30:<U5E73><U6210>:%EC%Ey<U5E74>";/
marcan /
Created Jan 25, 2019
Raspberry Pi Camera V2 DRM authentication example
import hmac, hashlib
# Data from I²C trace at
# Secret key from VideoCore blob
# serial[8], serial[7:4], serial[3:0]
serial = bytes.fromhex("EE8C196D8301230B59")
# rPi -> camera random number
numIn = bytes.fromhex("5805F3C898C3133154498E082F2E703516F2DBD1")
marcan /
Created Dec 22, 2018
Alesis Vortex Wireless 2 patch to send MIDI messages when pressing the ribbon bank buttons
from asm import *
blob = open("image.bin", "rb").read()
start_addr = 0x08003000
patch_start = start_addr + len(blob)
assert patch_start % 4 == 0
marcan /
Created Dec 22, 2018
Python module to assemble snippets of code
#!/usr/bin/env python
import os, tempfile, shutil, subprocess
class AsmException(Exception):
class BaseAsm(object):
def __init__(self, source, addr = 0):
self.source = source
self._tmp = tempfile.mkdtemp() + os.sep
marcan /
Last active Nov 5, 2019
Canon EF protocol notes

Testing done using a Canon EOS 600D and a Canon EF-S18-55mm f/3.5-5.6 IS II.


  1. VBAT
  2. DET (common with P-GND on lens side)
  3. P-GND
  4. VDD
  5. DCL
  6. DLC
marcan /
Last active Oct 6, 2019
Image to xterm-256 Unicode block art converter
#!/usr/bin/env python3
import sys, argparse, codecs
from PIL import Image, ImagePalette
xterm256colors = [ #
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x80, 0x00,
0x00, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xc0,
0x80, 0x80, 0x80, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0x00,
0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x87, 0x00, 0x00, 0xaf,
marcan / ghettohci.c
Created Apr 24, 2018
GhettOHCI - perhaps the world's smallest and stupidest OHCI stack.
View ghettohci.c
mini - a Free Software replacement for the Nintendo/BroadOn IOS.
ghettohci - debug over FT232 over OHCI
Copyright (C) 2012 Hector Martin "marcan" <>
# This code is licensed to you under the terms of the GNU GPL, version 2;
# see file COPYING or
marcan /
Last active Nov 28, 2018
Casio MemoPri (メモプリ) printer client
import sys, socket, struct
import PIL, PIL.Image, PIL.ImageOps
#!/usr/bin/env python3
import os, tempfile, shutil, subprocess, ctypes
class BaseAsmFunc(object):
def __init__(self, sfunc):
self.source = sfunc.__doc__
self._tmp = tempfile.mkdtemp() + os.sep
def compile(self, source):
marcan / wiipointer.c
Last active Jul 2, 2019
Wiimote sensor bar tracking and pointer control algorithm
View wiipointer.c
* Algorithm to process Wiimote IR tracking data into a usable pointer position
* by tracking the sensor bar.
* Copyright (c) 2008-2011 Hector Martin "marcan" <>
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
You can’t perform that action at this time.