Skip to content

Instantly share code, notes, and snippets.

View jdmichaud's full-sized avatar

jdmichaud

View GitHub Profile
@jdmichaud
jdmichaud / README.md
Last active May 1, 2025 09:05
Zig utils

Zig utils

  • clap.zig: Command line argument
  • draw.zig: Provide a canvas context 'like' interface for drawing
  • io-adapter:
    • Keyboard/mouse input + graphic output
    • One adapter for SDL for now
  • misc.zig:
    • Load a file
  • Write an image (pgm or pam)
@jdmichaud
jdmichaud / Makefile
Last active May 4, 2025 12:01
Expression Parser
# Compiler
CC = gcc
SANITIZEFLAGS=-fsanitize=address -fsanitize=undefined
# Compiler Flags
# -Wall -Wextra: Enable comprehensive warnings (recommended)
# -g: Include debugging symbols (for GDB)
# -std=c99: Specify C standard (or -std=c11, -std=gnu99 etc.)
# -O2: Optimization level (optional, use for release builds)
@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