Skip to content

Instantly share code, notes, and snippets.

@ywh233
ywh233 / patch_drc_mac80211.md
Last active September 18, 2020 01:05
Patch mac80211 kernel module for libdrc
  1. Run uname -r to find your kernel's version number. It may return something like this:

    5.4.0-47-generic
    
  2. Run sudo apt install linux-source-$KERNEL_VERSION to grab the kernel code. $KERNEL_VERSION should be the X.X.X part of the version returned by uname -r, e.g. sudo apt install linux-source-5.4.0.

@ywh233
ywh233 / parse_c_enum.js
Last active July 10, 2018 22:45
Simple JS function to parse a C enum definition. Helpful for looking up enum key from debug logs without manual counting or whatsoever.
/**
* Simple function to parse a C enum definition. E.g. Given a string like:
* A = 0,
* B,
* C = B,
* D
*
* Returns a map like: {"A": 0, "B": 1, "C": 1, "D": 2}
*
* @param str The enum definition string to parse.
function transpose(str, offset) {
let nstr = '';
for (var i = 0; i < str.length; i++) {
const cc = str.charCodeAt(i);
nstr += String.fromCharCode(cc + offset);
}
return nstr;
}
Install Wireshark
$ rvictl -s UUID
Monitor rvi0