Skip to content

Instantly share code, notes, and snippets.

View jdmichaud's full-sized avatar

jdmichaud

View GitHub Profile
@jdmichaud
jdmichaud / buildroot-riscv-kernel.md
Last active April 13, 2025 14:27
Builroot and RISCV
@jdmichaud
jdmichaud / Doxyfile
Created February 20, 2025 19:00
Doxygen
# Some sane config values
EXTRACT_ALL = YES
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
UML_LOOK = YES
UML_LIMIT_NUM_FIELDS = 50
TEMPLATE_RELATIONS = YES
@jdmichaud
jdmichaud / get-last-entry.sh
Last active February 17, 2025 13:54
artifactory
ARTIFACTORY_DOMAIN=$(grep '^registry=' ~/.npmrc | awk -F'=' '{print $2}' | awk -F/ '{print $3}')
ARTIFACTORY_TOKEN=$(grep '^//${ARTIFACTORY_DOMAIN}' ~/.npmrc | \
awk -F':' '{ print $2 }' | \
awk -F'_auth=' '{ print $2 }' | \
tr -d '"\r' | \
base64 -d | \
awk -F':' '{ print $2 }')
curl -H "Authorization: Bearer ${ARTIFACTORY_TOKEN}" \
"https://${ARTIFACTORY_DOMAIN}/artifactory/api/storage/${PATH_TO_RESOURCE}?list&deep=1&listFolders=1&mdTimestamps=1" \
@jdmichaud
jdmichaud / jenkins-hash.js
Created February 8, 2025 15:00
Jenkins hash
// Broken implementation
function hash(s) {
let hash = new Uint32Array(1);
hash[0] = 0;
for (let i = 0; i < s.length; ++i) {
const c = s[i].charCodeAt(0);
hash[0] += c;
hash[0] += (hash[0] << 10);
hash[0] ^= (hash[0] >> 6);
}
@jdmichaud
jdmichaud / xrandr.md
Created January 5, 2025 14:45
Multiscreen linux xrandr

Check you display configuration:

xrandr

To clone your computer screen to a different output:

xrandr --output <TV> --same-as <computer-screen>
@jdmichaud
jdmichaud / 8bitDo M30
Last active December 3, 2024 19:19
Module development
rest
[ 9030.422503] xpad-dbg: 00000000: 00 00 0f 7f 7f 7f 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 9030.422526] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
up
[ 9030.342505] xpad-dbg: 00000000: 00 00 0f 7f 00 7f 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[ 9030.342529] xpad-dbg: 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
down
[ 9054.410631] xpad-dbg: 00000000: 00 00 0f 7f ff 7f 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@jdmichaud
jdmichaud / systemd.md
Last active October 9, 2024 15:17
systemd cheatsheet

Create a systemd service

Create a unit file in /etc/systemd/system named foo.service. Then:

sudo systemctl start foo

If the file is modified:

sudo systemctl daemon-reload
@jdmichaud
jdmichaud / mouse.c
Created September 17, 2024 17:41
Set ratcheted on Logitech MX Master 3S
// cc -I/usr/include/hidapi/ -ggdb3 mouse.c -lhidapi-hidraw -o mouse
#include <stdio.h> // printf
#include <wchar.h> // wchar_t
#include <hidapi.h>
#include <string.h>
#define MAX_STR 255
int main(int argc, char* argv[])
@jdmichaud
jdmichaud / linkers-notes.md
Last active August 24, 2024 06:18
Linkers notes

Program linkers link object file together to create either:

  • An executable file
  • A shared library

Dynamic linkers link the executing program to a shared library at runtime.

Basic data types

Defined symbols are static objects within the source code that are defined for the entirety of the program (function or global and static variables).