Skip to content

Instantly share code, notes, and snippets.

@ifreund
ifreund / flags.zig
Last active January 8, 2023 16:07
Zero allocation argument parsing for unix like systems (zig 0.10)
// Zero allocation argument parsing for unix-like systems.
// Released under the Zero Clause BSD (0BSD) license:
//
// Copyright 2023 Isaac Freund
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
@ifreund
ifreund / globber.zig
Last active March 12, 2023 15:52
Basic prefix, suffix, and substring glob matching (zig 0.10)
// Basic prefix, suffix, and substring glob matching.
//
// Released under the Zero Clause BSD (0BSD) license:
//
// Copyright 2023 Isaac Freund
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
@ifreund
ifreund / generator.cpp
Created January 7, 2024 01:41 — forked from alebastr/generator.cpp
`XKB_KEYSYM_NO_FLAGS` vs `XKB_KEYSYM_CASE_INSENSITIVE`
// const char *key_names [] = {
// `sed -En 's/^#.*XKB_KEY_(\w*).*/"\1",/p' /usr/include/xkbcommon/xkbcommon-keysyms.h |sort -u`
// };
//
// g++ $(pkg-config --libs --cflags xkbcommon) generator.cpp
#include <cstdio>
#include <cstdlib>
#include <xkbcommon/xkbcommon.h>