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 / wezterm.lua
Last active August 28, 2023 21:06
wezterm tmux keybindings
local config = {}
config.key_tables = {
tmux_bindings = {
{ key = "a", mods = "CTRL", action=wezterm.action{SendString="\x01"}},
{ key = "\"", mods = "SHIFT", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
{ key = "%",mods = "SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
{
@madushan1000
madushan1000 / uuu-load-linux.lst
Last active April 14, 2023 21:34
bl808 load linux over fastboot using uuu
CFG: FB: -vid 0x18d1 -pid 0x4e40
FB: getvar version
FB: ucmd setenv fastboot_buffer 0x51000000
FB: download -f out/fw_payload.elf
FB: ucmd setenv fastboot_buffer 0x51500000
FB: download -f linux/arch/riscv/boot/Image.gz
FB: ucmd setenv fastboot_buffer 0x51400000

connect all the jtag pins and connect PU_CHIP pin to nReset/srst/sreset of the ftdi jtag adapter/rv debugger plus

and use the bellow config

pine64jtag.cfg

interface ftdi

#may need to change this to your adapters vid and pid
ftdi_vid_pid 0x0403 0x6014
@madushan1000
madushan1000 / 1-readme.md
Last active February 21, 2023 08:36
How to flash/boot bl808 over USB

Compile U-boot

Get riscv-32 musl toolchain. Get u-boot tree with usb support and compile it.

#toolchain
wget https://musl.cc/riscv32-linux-musl-cross.tgz
tar xf riscv32-linux-musl-cross.tgz
export PATH=$PWD/riscv32-linux-musl-cross/bin:$PATH

#u-boot
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 5.11.0-40-generic Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0"
CONFIG_CC_IS_GCC=y
CONFIG_GCC_VERSION=100300
CONFIG_LD_VERSION=236010000
CONFIG_CLANG_VERSION=0
CONFIG_LLD_VERSION=0
@madushan1000
madushan1000 / README.md
Last active October 7, 2020 18:07
sideload addons on android
  • Install the extension you want in desktop firefox, copy the path the extension(.xpi) file you want to install and copy the content relevent to the extension from exetensions.json(in firefox profile dir)
  • Change all the paths in that section to android paths(usually /data/data/org.mozilla.fenix/files/mozilla/<random string>.profile/extensions/<extension id>.xpi)
  • Edit the extensions.json in the android profile directory and include the section you modified above in addons array.
  • Copy the xpi file to /data/data/org.mozilla.fenix/files/mozilla/<random string>.profile/extensions/<extension id>.xpi
  • Enable adb debugging, enable remote debugging via usb on firefox android
  • Goto about:debugging on desktop firefox and connect to firefox on android, then select Main Process -> inspect and get the console
  • In the console run the following code, make sure to replace the relevent sections with correct paths, and keep a tab loaded with a webpage in fenix
Cu.import('resource://gre/modu
@madushan1000
madushan1000 / README.md
Created September 27, 2020 00:00
Run legacy/privileged extensions in stable/beta firefox
  1. Enable the browser console (about:config -> devtools.chrome.enabled=true) and open it.
  2. Copy the following code change the to your xpi file path and insert it into the browser console.
Cu.import('resource://gre/modules/addons/XPIInstall.jsm')
Cu.import('resource://gre/modules/addons/XPIProvider.jsm')
Cu.import('resource://gre/modules/addons/XPIDatabase.jsm')

var nsIFile = Components.Constructor( "@mozilla.org/file/local;1", "nsIFile", "initWithPath" );
var xpiFile = new nsIFile('<full path to xpi>');
series: bionic
description: A highly-available, production-grade Kubernetes cluster.
machines:
'0':
constraints: tags=k8s,master
'1':
constraints: tags=k8s,master
'2':
constraints: tags=k8s,worker
services:
{
"__inputs": [],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "5.2.3"
},
{