Skip to content

Instantly share code, notes, and snippets.

View kellertk's full-sized avatar
💭
🤔👨‍💻✨👉🚀

Tom Keller kellertk

💭
🤔👨‍💻✨👉🚀
View GitHub Profile
@kellertk
kellertk / autobaud.py
Last active April 3, 2023 03:36
Python autobaud script for serial devices
# This program was entirely written with ChatGPT 4, is untested, and should be
# considered alpha-quality software.
#
# Tom Keller, tom@tompkel.net, 2023
# To the maximum extent possible under law, I waive all copyright and related or
# neighboring rights to this work. This work is licensed under Creative Commons
# CC0, available at https://creativecommons.org/publicdomain/zero/1.0/legalcode
import sys
import argparse
import serial
@kellertk
kellertk / abl_speed_test.gcode
Created February 5, 2023 06:19
Marlin gcode to level the bed and report how long it took. Used to benchmark different Z_PROBE settings.
;
; Copyright Tom Keller. Distributed under the Boost Software License, Version 1.0.
; (See https://www.boost.org/LICENSE_1_0.txt)
;
M155 S60 ; Set status interval to 60 seconds
M104 S140 ; Set temps for abl
M140 S60
G28 O ; Home
M190 S60 ; Wait for temps
M109 S140
@kellertk
kellertk / poketypes.ts
Last active May 9, 2022 22:43
Doing a code review for me? It's dangerous to go alone, take this:
export type tentacool = boolean;
export type umbreon = number;
export type weezing = string;
export type luxray<t> = Array<t>;
export type squirtle<t, t2> = [t, t2]; //tuple
export type unown = unknown;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ditto = any;
export type snover = never;
export type missingno = undefined;

The PiSugar2 is a battery board for the Raspberry Pi Zero. It has an integrated RTC chip available over I2C, but there are no drivers included in the kernel with the latest release of the pwnagotchi (or Kali in general). It's a ZXW Shenzhen SD3078; there is surprisingly little information out there about this chip. I suspect it's newish.

The PiSugar folks expect you to install Pisugar Power Manager, which is a web service to get battery status and set the RTC. I prefer to use the standard hwclock utility, because I don't need the extra function in the web interface. There is driver support for this chip in kernels 5.1 or newer, so we can grab that and compile it as an out of tree module. You may be able to adapt these ins