Skip to content

Instantly share code, notes, and snippets.

View Leandros's full-sized avatar
🦀
Available for Rust contracting

Arvid Gerstmann Leandros

🦀
Available for Rust contracting
View GitHub Profile
#define INSTRUCTIONS \
_(0x7D, ADC, ABSOLUTE_X)
// ...
// Execution
#define _(byte, operation, mode) \
case byte: \
mode \
b = READ8(address); \

Graphical User Interfaces

Last time I wrote a little bit about my current GUI research progress. There are some things that were misunderstood so I want to clarify some fundamental design decisions and finally write up some current problems and their solutions.

First up I want to clarify a component is not another term for what is usually refered to as widget. Instead wigets in this implementation are made out of n >= 1 components. Components themself are just rectangles with attributes left, right, top, bottom, center_x, center_y, width and height some behavior flags and an optional surface to draw into. For example a scroll regions is made up out of at least three

@dwilliamson
dwilliamson / Pimpl.cpp
Last active May 12, 2017 16:10
How I Pimpl
struct Data
{
Data()
{
}
~Data()
{
}
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active April 15, 2025 22:49
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

NOTE: I'm not necessarily advocating this as the way to make your compiler go fast. Priority 1 is to make
full recompilation as fast as possible, ideally on the order of 100 MB/s per core with everything in memory.
Once you get it that fast, there's probably no need for incremental techniques, even if you want to
recompile entire files in real-time as the programmer types in code. But these incremental algorithms are
interesting computer science, so you should learn about them, and they are certainly applicable elsewhere.
After watching an interview with Anders Hejlsberg last year in which he mentioned the incremental
compilation techniques they used in their new C# and TypeScript compilers, I spent a bit of time studying
their open source code (and it's great that MS now makes this stuff available for people to peruse).
@pervognsen
pervognsen / vex.c
Last active October 23, 2022 11:02
// The stack is 8-byte aligned.
#define ALIGN(p) ((uint64_t *)(((uintptr_t)(p) + 7) & ~7))
#define STACK(stack, size) uint64_t *_stack = ALIGN(stack), *_stack_end = (uint64_t *)((char *)(stack) + size)
#define PUSH(x) do { memcpy(_stack, &x, sizeof(x)); _stack += (sizeof(x) + 7) / 8; } while (0)
#define POP(x) do { _stack -= (sizeof(x) + 7) / 8; memcpy(&x, _stack, sizeof(x)); } while (0)
#if __GNUC__
// Use computed gotos on GCC-compatible compilers (including Clang).
#define JOIN(x, y) x##y
#define LABEL(name) JOIN(label, name)
Vex is a minimalistic markup language with the motto "form without meaning".
This is going to @italic=really hurt.
// @author: Per Vognsen
// @version: 1.3
The weather forecast for @date is @weather.
@list{
@paniq
paniq / vr_protocol.md
Last active April 11, 2019 03:12
A Decentralized Virtual Reality Protocol

A Decentralized Virtual Reality Protocol

by Leonard Ritter, Duangle GbR

*The metaverse can be a utopia or it can be a dystopia. And we are very fortunate that the PC platform is the number one platform for serious computing today, and the internet underlying it are all completely open technologies. Anybody can build software. Anybody can distribute it. Anybody can do anything without getting anybody's permission. I feel we have seen a major retraction from that great state of affairs over the past decade, as closed platforms (...) have grown to the forefront of the industry. (...) And I wanted to point out that this was not inevitable. (...) As we are creating a new medium together it would be really tragic if the future metaverse that binds all humanity together into shared online environments were a closed platform controlled by a giant corporation. As always, they would use it to spam you with advertising. They would use it to gather information about your private life

/* Lightweight module based templates in standard C
===================================================
This is a proof of concept example of lightweight module based templates in C and
is loosely based on https://gist.github.com/pervognsen/c56d4ddce94fbef3c80e228b39efc028 from Per Vognsen.
While his approach (at least as far as I understood) is based on a python script to generate
the .h/.c files for you is this implementation contained in one single header file.
This is an outline to show how you can use the single header approach
and bend it to its absolute extrems. I tend to write specialized datastructures
for most of my problems but sometimes it happens that I have to use a particular
@NocturnDragon
NocturnDragon / Swizzles.h
Last active October 15, 2023 01:20
Swizzles in Clang, GCC, and Visual c++
#include <stdio.h>
// #define CLANG_EXTENSION
// Clang compile with -O3
#define VS_EXTENSION
// https://godbolt.org/z/sVWrF4
// Clang compile with -O3 -fms-compatibility
// VS2017 compile with /O3