Skip to content

Instantly share code, notes, and snippets.

View madushan1000's full-sized avatar

Madushan Nishantha madushan1000

View GitHub Profile
@madushan1000
madushan1000 / zmk_split_battery_level_linux.py
Created January 16, 2024 22:25
See battery levels of a zmk split ble keyboard on linux
from dbus_next.aio import MessageBus
from dbus_next.constants import BusType
import asyncio
BLUEZ = "org.bluez"
#replace hci0 with your bluetooth adapter name and FF_FF_FF_FF_FF_FF with your keyboard address
BLUEZ_PATH = "/org/bluez/hci0/dev_FF_FF_FF_FF_FF_FF"
GATT_SERVICE = 'org.bluez.GattService1'
GATT_CHARACTERISCITC = 'org.bluez.GattCharacteristic1'
GATT_CHARACTERISCITC_DESCR = 'org.bluez.GattDescriptor1'
BATTERY_UUID = "0000180f-0000-1000-8000-00805f9b34fb"
@madushan1000
madushan1000 / readme.md
Last active June 23, 2024 14:50
Reverese engineer a static library one function at a time.

GCC has an interesting flag we can use to switch out an implementation of a function at link time, called "wrap".  I think this is usually used for testing functions with unpredictable inputs. But we can use this to add a reverse-engineered implementation and redirect all references in the object code to our implementation. If we want to replace

void some_func() {}

We must name our implementation __wrap_some_func(). So we have to add __wrap_ to the beginning of the function name.

void __wrap_some_func() {
  //some code
@madushan1000
madushan1000 / meson.build
Created November 27, 2024 12:06
libcore meson.build
project('libcore', ['java'])
openjdk_javadoc_files = [
'ojluni/src/main/java/java/awt/font/NumericShaper.java',
'ojluni/src/main/java/java/awt/font/TextAttribute.java',
'ojluni/src/main/java/java/beans/IndexedPropertyChangeEvent.java',
'ojluni/src/main/java/java/beans/PropertyChangeEvent.java',
'ojluni/src/main/java/java/beans/PropertyChangeListener.java',
'ojluni/src/main/java/java/beans/PropertyChangeListenerProxy.java',
'ojluni/src/main/java/java/beans/PropertyChangeSupport.java',