Skip to content

Instantly share code, notes, and snippets.

View nraynaud's full-sized avatar
🌵
learning new things

Nicolas Raynaud nraynaud

🌵
learning new things
View GitHub Profile
@nraynaud
nraynaud / generated_enums.py
Created November 5, 2025 10:53
spinel.h parsing in python
from enum import Enum
class spinel_status_t(Enum):
#< Operation has completed successfully.
SPINEL_STATUS_OK = 0
#< Operation has failed for some undefined reason.
SPINEL_STATUS_FAILURE = 1
#< Given operation has not been implemented.
SPINEL_STATUS_UNIMPLEMENTED = 2
#< An argument to the operation is invalid.

why are greases made of a metallic soap mixed with an oil?

Greases are made of a metallic soap mixed with an oil because this combination creates a semi-solid lubricant that combines the lubricating properties of oils with the structure and stability provided by soaps.

Here’s how it works:

  1. Metallic soaps act as a thickener.

    • A metallic soap is a compound formed by reacting a fatty acid with a metal hydroxide (such as lithium, calcium, sodium, or aluminum hydroxide).
  • This reaction produces a fibrous or sponge-like structure that can trap and hold oil within it — much like a sponge holds water.
@nraynaud
nraynaud / hessian.md
Created August 24, 2025 10:34
hessian corners AI

Me

generate the corner values with the cross terms of the hessian, and show your code is correct in a comment

AI Assistant

I'll generate the corner values with cross terms for the Hessian matrix and create code to demonstrate its correctness.Looking at the code in the test file, I can see there's a function that needs to be completed to generate corner values with cross terms of the Hessian. Let me examine the current implementation and complete it: generateNeighborhood

    function generateNeighborhood (centerVal, gradient, hessian) {
      const neighborhood = [new Array(9).fill(0), new Array(9).fill(0), new Array(9).fill(0)]
      const setVal = (val, i, j, k) => {
        neighborhood[k][i + 3 * j] = val

Me

can you write compute_least_squares ?

AI Assistant

I'll write the function for you. Based on the context, this appears to be for refining extrema positions in a computer vision/image processing algorithm (likely SIFT or similar), where you need to solve the linear system Hx = -g to find the sub-pixel offset. compute_least_squares

fn compute_least_squares(hessian: mat3x3f, gradient: vec3f) -> vec3f {
    // Solve Hx = -g for x, where H is the Hessian and g is the gradient
    // This gives us the sub-pixel offset for extrema refinement
    
@nraynaud
nraynaud / cancel.g
Created February 19, 2025 15:09
Duet3D configuration for multi-tool see https://www.thingiverse.com/thing:4010872
; stop.g
; called when a print is cancelled after a pause.
T-1
G1 X100 Y350 F35000
@nraynaud
nraynaud / Notes Sojourner.md
Last active February 1, 2026 16:19
Notes on the mechanical design of the Sojourner rover
@nraynaud
nraynaud / Containerfile
Last active November 10, 2024 22:55
build Zstack with docker
# SPDX-License-Identifier: MIT
#
# Copyright (C) 2024 Olliver Schinagl <oliver@schinagl.nl>
ARG UBUNTU_VERSION="22.04"
ARG TARGET_ARCH="library"
FROM index.docker.io/${TARGET_ARCH}/ubuntu:${UBUNTU_VERSION}
ENV HOME="/build"
@nraynaud
nraynaud / vmdk.grammar
Last active February 26, 2022 01:31
VMDK grammar for synalyze pro
<?xml version="1.0" encoding="UTF-8"?>
<ufwb version="1.17">
<grammar name="VMDK" start="id:6" author="Nicolas Raynaud" email="nraynaud@gmail.com" fileextension=".vmdk">
<description>VMDK streamOptimized file format. Licenced under Affero GPL, the copyright owner is Vates SAS. This is a work for hire by Nicolas Raynaud.</description>
<scripts>
<script name="Sector64" type="DataType" id="142">
<source language="Python"># custom data type script
def parseByteRange(element, byteView, bitPos, bitLength, results):
# this method parses data starting at bitPos, bitLength bits are remaining
@nraynaud
nraynaud / am5729-beagleboneai-custom.dts
Last active December 4, 2020 01:57
beaglebone AI PRU2 unipolar stepper
#include "am5729-beagleboneai.dts"
// make it easy to determine which dtb you're currently running on
// (via /proc/device-tree/chosen/)
/ {
chosen {
base_dtb = "am5729-beagleboneai-custom.dts";
base_dtb_timestamp = __TIMESTAMP__;
};
};
// eventually these should be available in a header
@nraynaud
nraynaud / Save Tool Offsets.g
Created March 20, 2020 20:57
Saving probed tool offset in duet wifi
M500 P10