Skip to content

Instantly share code, notes, and snippets.

@NotKit
NotKit / lvm_migrator.sh
Created October 13, 2025 12:41
Migrate existing ext4 partition to LVM physical volume in-place. Inspired by https://chromium.googlesource.com/chromiumos/platform2/+/main/thinpool_migrator/
#!/bin/sh
# Copyright (c) 2025 TheKit <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (C) 2025 TheKit
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Generate libinput quirks for devices with problematic kernel drivers.
On some devices (commonly OnePlus/OPPO/Realme), the touchscreen kernel driver
@NotKit
NotKit / lvm_migrator.cc
Created September 17, 2025 07:59
Migrate existing ext4 partition to LVM physical volume in-place. Inspired by https://chromium.googlesource.com/chromiumos/platform2/+/main/thinpool_migrator/
#include <iostream>
#include <string>
#include <cstdint>
#include <fstream>
#include <random>
#include <format>
#include <chrono>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
@NotKit
NotKit / udevd-nodevtmpfs.c
Last active December 13, 2022 20:40
LD_PRELOAD workaround to create devnodes by udev on devices without CONFIG_DEVTMPFS in kernel
#define _GNU_SOURCE
#include <errno.h>
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/stat.h>
#include <libgen.h>
@NotKit
NotKit / Gemini_PDA_UBPorts.md
Last active August 27, 2025 09:44
Gemini PDA - UBPorts

Running Ubuntu Touch on Gemini PDA

Installation

Use prebuild system.img and get the ubports edge rootfs from here.

Boot into TWRP and install it with the JBB's halium-install script.

./halium-install -p ut ubports-touch.rootfs-xenial-edge-armhf.tar.gz system.img
adb push halium-boot.img /tmp
@NotKit
NotKit / 00_remove_mt_width_major.diff
Created March 27, 2018 22:58
Fix OnePlus 2 touchscreen
diff --git a/drivers/input/touchscreen/synaptics_driver_s3320.c b/drivers/input/touchscreen/synaptics_driver_s3320.c
index 79b184a0..f3d3872f 100644
--- a/drivers/input/touchscreen/synaptics_driver_s3320.c
+++ b/drivers/input/touchscreen/synaptics_driver_s3320.c
@@ -2105,7 +2105,6 @@ static int synaptics_input_init(struct synaptics_ts_data *ts)
set_bit(EV_ABS, ts->input_dev->evbit);
set_bit(EV_KEY, ts->input_dev->evbit);
set_bit(ABS_MT_TOUCH_MAJOR, ts->input_dev->absbit);
- set_bit(ABS_MT_WIDTH_MAJOR,ts->input_dev->absbit);
set_bit(ABS_MT_POSITION_X, ts->input_dev->absbit);
@NotKit
NotKit / droid4-fb.c
Created March 14, 2018 19:46
Small tool to activate framebuffer output on Droid 4 with Android kernel
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/resource.h>
#include <linux/fb.h>
#include <assert.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
@NotKit
NotKit / local_manifest_addison.xml
Created August 13, 2017 09:33
Moto Z Play SailfishOS port
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="NotKit/android_device_motorola_addison" path="device/motorola/addison" remote="github" revision="hybris-13" />
<project name="NotKit/android_kernel_motorola_msm8953" path="kernel/motorola/msm8953" remote="github" revision="hybris-13"/>
<project name="LineageOS/android_external_bson" path="external/bson" remote="github" revision="cm-13.0"/>
<project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-13.0" />
<project name="Alberto97/proprietary_vendor_motorola" path="vendor/motorola" remote="github" revision="8fe11afb30479622e6bc461ab31a1c421b06a03f" />
<project name="MotorolaMobilityLLC/motorola-external-greybus" path="hardware/motorola/greybus" remote="github" revision="marshmallow-6.0.1-release-griffin" />
<remove-project name="mer-hybris/android_bionic" />
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/motorola/maserati" name="NotKit/android_device_motorola_maserati" revision="hybris-11.0" />
<project path="device/motorola/omap4-common" name="NotKit/android_device_motorola_omap4-common" revision="hybris-11.0" />
<project path="kernel/motorola/omap4-common" name="NotKit/android_kernel_motorola_omap4-common" revision="hybris-11.0" />
<project path="vendor/motorola" name="TheMuppets/proprietary_vendor_motorola" revision="cm-11.0" />
<project path="rpm" name="NotKit/droid-hal-maserati" remote="github" revision="master" />
<project path="hybris/droid-configs" name="NotKit/droid-config-maserati" remote="github" revision="master" />
<project path="hybris/droid-hal-version-maserati" name="mer-hybris/droid-hal-version-maserati" remote="github" revision="master" />
@NotKit
NotKit / android-ia_kernel_intel_baytrail_x86_64_onda_v820w_v3_defconfig
Created August 25, 2016 20:21
Sailfish OS kernel config for Onda V820W V3
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 3.10.20 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"