Skip to content

Instantly share code, notes, and snippets.

cvs -q up -PAd

joshua stein jcs

cvs -q up -PAd
Block or report user

Report or block jcs

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
jcs /
Created Jul 19, 2019
Matebook X DSDT - Touchpad (TPL1)
    Scope (_SB.PCI0.I2C1)
        Device (TPL1)
            Name (HID2, Zero)
            Name (SBFB, ResourceTemplate ()
                I2cSerialBusV2 (0x004C, ControllerInitiated, 0x00061A80,
                    AddressingMode7Bit, "\\_SB.PCI0.I2C1",
jcs /
Last active Jul 19, 2019
The Great ihidev(4) Debugging

The Problem

  • I2C-connected Windows Precision Touchpads on Skylake and newer laptops don't generate interrupts through the IOAPIC when using OpenBSD - polling has to be used to fetch touchpad data


ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 120 pins
dwiic0 at pci0 dev 21 function 0 "Intel 100 Series I2C" rev 0x21: apic 2 int 16
jcs /
Last active Dec 19, 2016
moving git commits from one tree to another
# moving git commits from one tree to another, preserving original git commit metadata like date/time
# (creating a new hash, of course)
# find current commits
git log jcs --no-merges --oneline --no-abbrev-commit --reverse | sed 's/ .*//' > commits
# in new git tree, for each $hash in $commits
git --git-dir=/path/to/old/tree/.git format-patch -k -1 --stdout <hash> | git am -3 -k
jcs / netpbm-resize pseudo-code
Created Jun 4, 2016
using netpbm to resize jpegs and pngs of arbitrary size to fixed square, preserving ratio with transparency
View netpbm-resize pseudo-code
# solution for resizing jpegs and pngs of arbitrary size down to a 72x72
# square, preserving source ratio, and filling non-square sides with
# transparency
# ahead of time, convert a transparent 72x72 png to blank-72.pam and save
# it with your code
# pngtopam -quiet -alphapam < blank-72.png > blank-72.pam
jcs /
Last active Aug 28, 2017
OpenBSD (with encrypted softraid) on the Chromebook Pixel (2015)
jcs / asus
Last active Feb 23, 2020
Disabling SPI write protection, reflashing, and unbricking an Asus Chromebook C201
View asus

####Disabling SPI write protection

Put the Chromebook in developer-mode:

  • With machine powered off, hold down Esc and Refresh(F3) while hitting power button
  • At warning prompt, hit Control+D, then Enter at prompt about enabling developer mode
  • Machine will format itself

Now remove the write-protect screw to enable flashrom to flash new Coreboot/Libreboot.

Flip powered-off machine over and remove 8 philips-head screws. 2 are located under rubber feet.


Keybase proof

I hereby claim:

  • I am jcs on github.
  • I am jcs ( on keybase.
  • I have a public key whose fingerprint is 51DE 5E0C 5643 6F37 D718 0936 603C A7D7 27C9 E467

To claim this, I am signing this object:

jcs / gist:5573685
Last active Oct 25, 2019
macOS FileVault encryption and OpenBSD encrypted softraid on a Macbook Air/Pro
View gist:5573685

Update (2019-05-06): The Broadcom wireless card in the MacBook Pro works and can be crammed into the Air.

Update (2015-12-04): This document used to be very lengthy as there were many manual steps required to get OpenBSD and Mac OS X working together through Boot Camp Assistant (BCA), which created a hybrid MBR and enabled a legacy BIOS emulation mode which older versions of Windows (and OpenBSD) required. Newer Macbooks stopped supporting older versions of Windows through BCA and now only support Windows 10 since it uses GPT and UEFI. However, now that newer versions of OpenBSD support GPT and UEFI, Boot Camp Assistant is no longer needed at all to boot OpenBSD.

macOS FileVault encryption and OpenBSD encrypted softraid on a Macbook Air/Pro

OpenBSD works pretty well on at least the Mid-2011 Macbook Air (A1370, SandyBridge) and Mid-2013 Macbook Air (Haswell). The new KMS code in 5.4 brings up the MBA's eDP display in 1366x768 with backlight

You can’t perform that action at this time.