Skip to content

Instantly share code, notes, and snippets.

View melonedo's full-sized avatar

melonedo

View GitHub Profile
@HTD
HTD / !HAL_I2C-NB.md
Last active September 28, 2025 01:30
HAL I2C truly non-blocking reads.

STM32 HAL I2C TRULY NON-BLOCKING MEMORY I/O

Makes HAL_I2C_Mem_Read_IT and HAL_I2C_Mem_Write_IT truly non-blocking.

Known issues:

  • needs a configured system timer to provide interrupts,
  • needs a modification in original HAL driver,
  • needs an extra helper (delay_async.c / delay_async.h).
  • internal delays depend on the timer tick time (default 1ms here) so smaller intervals require smaller timer period.
@superboum
superboum / benchmark-base.md
Last active September 24, 2025 12:41
Benchmark your disk with FIO

Install FIO on Ubuntu/Debian:

sudo apt update
sudo apt install -y fio lshw

Install FIO on Fedora:

@heyfluke
heyfluke / remap_docker_user_to_host_user.md
Last active July 9, 2025 00:10
remap docker user to host user.

Problem

When I use docker to work with the shared workspace with host under Ubuntu, I find that files created by docker user is owned by root. This is not the same with macOS.

Maybe this is becuase docker is run by root user and the default user mapping mechanism is to map container-root to host-user or host-root. So can I map the container-root or container-any-user to host-current-user?

Fortunately the latest docker supports the re-map the container user to any host user via Linux namespace. Refer to this.

Linux namespace

@mbinna
mbinna / effective_modern_cmake.md
Last active December 6, 2025 05:54
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@vxgmichel
vxgmichel / aioudp.py
Last active February 24, 2025 10:28
High-level UDP endpoints for asyncio
"""Provide high-level UDP endpoints for asyncio.
Example:
async def main():
# Create a local UDP enpoint
local = await open_local_endpoint('localhost', 8888)
# Create a remote UDP enpoint, pointing to the first one
@ipcjs
ipcjs / +Rime+小鹤双拼+颜文字+笔画混合输入方案.md
Last active August 19, 2025 15:54
Rime+小鹤双拼+颜文字+笔画混合输入方案

Rime+小鹤双拼+颜文字+笔画混合输入方案

概述

方案配置文件+详细说明:Rime+小鹤双拼+颜文字+笔画混合输入方案

实现的功能是:给小鹤双拼添加颜文字支持,直接打双拼出颜文字,支持模糊音,支持词频调整,同时不影响小鹤双拼自带的笔画反查。

要实现双拼+颜文字的功能网上已经有很多方法,但都有些弊端,这里分别简单介绍下: