Skip to content

Instantly share code, notes, and snippets.

View charlesnicholson's full-sized avatar

Charles Nicholson charlesnicholson

View GitHub Profile
@charlesnicholson
charlesnicholson / gist:5f066d9f0ea2f7b484ac
Last active December 3, 2021 20:08
compile-time string concatenation
#include <cstdio>
namespace detail {
template<unsigned count, template<unsigned...> class meta_functor, unsigned... indices>
struct apply_range {
typedef typename apply_range<count - 1, meta_functor, count - 1, indices...>::result result;
};
template<template<unsigned...> class meta_functor, unsigned... indices>
struct apply_range<0, meta_functor, indices...> {
@charlesnicholson
charlesnicholson / improg.gif
Last active April 2, 2023 15:57
improg image
improg.gif
@charlesnicholson
charlesnicholson / build_wheel.py
Last active September 2, 2023 14:32
Python script for building a wheel with optional data copy-in and platform wheel tagging
import argparse
import os
import pathlib
import shutil
import subprocess
import sys
import tempfile
def _parse_args():
@charlesnicholson
charlesnicholson / cobs.c
Created December 28, 2023 22:11
Demonstrate bugs in Wikipedia's cobsDecode C sample
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#define USE_WIKIPEDIA_COBS_DECODE 1
#if USE_WIKIPEDIA_COBS_DECODE
size_t cobsDecode(const uint8_t *buffer, size_t length, void *data) {
assert(buffer && data);