Skip to content

Instantly share code, notes, and snippets.

@ReliefCrew
ReliefCrew / zfs-root-tpm.sh
Last active January 19, 2024 19:32
Enable auto unlock of a Debian encrypted ZFS root using a TPM 1.2 device [https://news.ycombinator.com/item?id=35066894]
#!/usr/bin/env bash
cat > /dev/null <<EOF
qemu-img info zroot.qcow2
qemu-img resize zroot.qcow2 +120G
zpool status rpool # to confirm partition
parted
@ReliefCrew
ReliefCrew / zfs-root-sign.sh
Last active November 14, 2024 20:49
Enable Secure Boot when using an encrypted ZFS root with Debian [https://news.ycombinator.com/item?id=35066894]
#!/usr/bin/env bash
test $EUID -eq 0 || echo "Exiting, must have root... use sudo!"
test $EUID -eq 0 || exit 1
TOPLOC=/var/lib; MOKLOC=$TOPLOC/shim-signed/mok
zpool get -H feature@encryption \
$(df $TOPLOC --output=source | tail -n-1 | cut -d/ -f1) | \
grep -qP '\sactive\s'
if [ $? -ne 0 ]; then
@ReliefCrew
ReliefCrew / interactive_brokers_api_bug.md
Last active April 1, 2023 04:12
Interactive Brokers API race condition

Summary

In the 10.x versions of TraderWorkstation (TWS) and IBGateway software, non-simultaneous clients with ID numbers different from the first don't receive price ticks for a given stock after requesting them.

Note: additional public discussion is occuring here.

Details

After signing into the IBGateway (or TWS) application, a client program can't get ticks for a stock unless subsequent invocations use the same client ID as the first instance which requested those ticks.

In other words, during the same login session (without exiting the IBGateway/TWS software)... if a client program connects with ID #5 and receives ticks for IBM and subsequently exits, then any new client that requests ticks for IBM needs to connect using ID #5. If the original client ID number is not used, price ticks for IBM won't be received.

@ReliefCrew
ReliefCrew / colorfix.js
Last active March 5, 2023 20:55
Bookmarklet that turns dark mode site colors back to light mode. Source: https://news.ycombinator.com/item?id=32719488
javascript: (() => {
document.documentElement.style.filter = "invert()";
document.documentElement.style.background = '#000'
})();
@ReliefCrew
ReliefCrew / wikifix.js
Last active September 7, 2022 09:36
Bookmarklet that removes key elements from wikipedia articles to recapture some screen space. Useful for those of us who browse in portrait mode.
javascript: (() => {
['mw-panel', 'mw-head', 'mw-page-base'].
forEach((id) => document.getElementById(id).remove());
document.getElementById("content").style.setProperty('margin-left', '0');
})();