Skip to content

Instantly share code, notes, and snippets.

@xiechao06
xiechao06 / todo_search.md
Created March 11, 2026 09:18
TODO comments search results

No TODO comments found in samples/book-app-project/**/*.py

Files checked:

  • books.py
  • book_app.py
  • utils.py
  • tests/test_books.py

Implement Custom Providers for Serverpod

Analysis of EmailIdpPConfigFromPasswords

Class EmailIdpPConfigFromPasswords is just convenient subclass of EmailIdp which set secretHashPepper(a global secret shared across the entire application).

Class EmailIdp is a subclass of IdentityProviderBuilder<EmailIdp>, just as its name implies, it builds IdentityProvider.

class EmailIdpConfig {
@xiechao06
xiechao06 / How to setup vscode uv + pybind11.md
Last active July 29, 2025 07:38
How to setup vscode for uv + pybind11

How to setup vscode for uv + pybind11

The problem

The official documentation of uv doesn't explain how to setup vscode for using build backend scikit-build-core. So, you will find code intellisense or lsp server failed to work in cpp files and CMakelists.txt, as shown in the following images:

main.cpp

Here we use clangd as lsp server.

@xiechao06
xiechao06 / Gmesh-introduction.md
Last active June 11, 2025 05:53
Gmesh软件使用说明

Gmesh软件使用说明

Gmesh简介

  • 官网文档
  • 3D有限元网格生成工具, 有基础CAD功能(在OpenCASCADE CAD kernel和built-in CAD引擎上构建) 以及后处理功能。
  • 大型开源C++项目, 400K loc.
  • 使用广泛(15,000 downloads/年),影响力大(1000 citations/year).
  • 1996年开始不间断更新。
@xiechao06
xiechao06 / get_bits.cpp
Created March 7, 2025 01:11
get bits of float/double
#include <bitset>
#include <cmath>
#include <iostream>
#include <sys/types.h>
std::bitset<32> get_bits(float x) {
int *y = reinterpret_cast<int *>(&x);
std::bitset<32> bs(*y);
return bs;
}
@xiechao06
xiechao06 / binary_repr.cpp
Created March 3, 2025 09:30
get the binary representation of a positive number
#include <algorithm>
#include <cmath>
#include <format>
#include <iostream>
#include <utility>
#include <vector>
std::pair<std::vector<bool>, std::vector<bool>>
binary_expr(double positive_num, size_t fractional_bits = 32) {
std::vector<bool> integer_part_bits;
@xiechao06
xiechao06 / flex_bison_setup.cmake
Last active September 28, 2024 09:44
cmake snippets
include_directories(${CMAKE_CURRENT_BINARY_DIR})
find_package(BISON)
find_package(FLEX)
BISON_TARGET(MyParser parser.yy ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h)
FLEX_TARGET(MyScanner scanner.ll ${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp
DEFINES_FILES ${CMAKE_CURRENT_BINARY_DIR}/scanner.h)
add_executable(foo foo.cpp ${BISON_MyParser_OUTPUTS} ${FLEX_MyScanner_OUTPUTS})
@xiechao06
xiechao06 / CMakePresets.darwin.json
Last active September 24, 2024 10:38
a CMakePresets.json for conda/mamba
{
"version": 8,
"$schema": "https://cmake.org/cmake/help/latest/_downloads/3e2d73bff478d88a7de0de736ba5e361/schema.json",
"configurePresets": [
{
"name": "debug",
"displayName": "Debug",
"hidden": false,
"description": "Default configuration",
"generator": "Ninja",
@xiechao06
xiechao06 / debug_token.h
Created September 23, 2024 09:44
debug token in flex
#ifndef E92B818E_7A62_4864_B016_C59C0D879D59
#define E92B818E_7A62_4864_B016_C59C0D879D59
#include <stdarg.h>
#include <stdio.h>
#ifdef DEBUG_TOKEN
#define debug_token(token) \
do \
{ \
@xiechao06
xiechao06 / show_tree_view.adoc
Created January 27, 2022 02:39
show tree view in adoc

abc

skinparam Legend {
	BackgroundColor transparent
	BorderColor transparent
}
legend