Skip to content

Instantly share code, notes, and snippets.

@cpdt
cpdt / flatparser.cpp
Last active February 6, 2020 11:31
A simple and pretty fast "flat INI" parser - for when you just need to read a list of key/value pairs that can have escape sequences
#include "flatparser.h"
// Parsing utils
static bool is_whitespace(char c) {
return c == ' ' || c == '\t';
}
static bool is_end_of_line(const char *text) {
return *text == 0 || *text == '\n' || (text[0] == '\r' && text[1] == '\n');
}
@cpdt
cpdt / minimal.rs
Last active September 24, 2024 13:18
A minimal Rust file with no_std for sizecoding (4k, 8k, 64k, etc)
#![no_std]
#![no_main]
#![feature(core_intrinsics, lang_items, link_args, alloc, alloc_error_handler)]
#[allow(unused_attributes)]
#[link_args = "/NODEFAULTLIB /SUBSYSTEM:WINDOWS /SAFESEH:NO /DYNAMICBASE:NO /ENTRY:WinMainCRTStartup /LTCG support/msvcrt.lib"]
extern "C" {}
#[macro_use]
extern crate alloc;

Keybase proof

I hereby claim:

  • I am cpdt on github.
  • I am cpdt (https://keybase.io/cpdt) on keybase.
  • I have a public key ASBvD8Mp8b4i_sfJk0wdJ4v_ASrpwt0W2kE--QxUbrEi-wo

To claim this, I am signing this object: