Skip to content

Instantly share code, notes, and snippets.

View Khitiara's full-sized avatar

Lilly Sieberer Khitiara

View GitHub Profile
pub const DoublyLinkedNode = extern struct {
next: ?*DoublyLinkedNode = null,
prev: ?*DoublyLinkedNode = null,
};
pub fn DoublyLinkedList(comptime T: type, comptime field_name: []const u8) type {
return struct {
head: ?*DoublyLinkedNode = null,
tail: ?*DoublyLinkedNode = null,
pub const Node = extern struct {
next: ?*Node = null,
};
pub fn PriorityQueue(comptime T: type, comptime node_field_name: []const u8, comptime prio_field_name: []const u8, comptime P: type) type {
const Tails = std.EnumArray(P, ?*Node);
const Indexer = Tails.Indexer;
return struct {
head: ?*Node,
tails: Tails = Tails.initFill(null),
@Khitiara
Khitiara / overview.md
Created February 12, 2024 19:01
SilkX Async Design "Velvet"

Design Constraints

  1. Should be possible to use async/await in a single- or dual-threaded graphics context.
  2. Basic implementation can take inspiration therefore from the windows forms and/or wpf synchronization contexts.
  3. Keep heap allocations down where possible to avoid GC hits.
  4. Therefore, ValueTask everywhere.

In order to control async/await control flow, two mechanisms can be used:

  • Custom SynchronizationContext
  • Custom GetAwaiters
@Khitiara
Khitiara / root.zig
Last active January 2, 2024 06:23
zig com iunknown attempt
const std = @import("std");
const testing = std.testing;
const uuid = @import("uuid");
pub fn getInterfaceId(comptime T: type) uuid.Uuid {
comptime {
if (@typeInfo(T) != std.builtin.TypeId.Struct) {
@compileError("COM Interface must be struct");
}
@Khitiara
Khitiara / All tests from Solution.testsession
Last active April 5, 2022 19:53
Failing unit test cases
SmartEnumJsonPropertyName (2 tests) Failed: 2 tests failed
SmartEnumJsonPropertyName (2 tests) Failed: 2 tests failed
UnitTest1 (2 tests) Failed: One or more child tests failed: 2 tests failed
TestStringEnumDeserializes Failed: System.NotSupportedException: The type 'SmartEnumJsonPropertyName.UnitTest1+TestStringEnum' is not a supported dictionary key using converter ...
TestStringEnumSerializes Failed: System.NotSupportedException: The type 'SmartEnumJsonPropertyName.UnitTest1+TestStringEnum' is not a supported dictionary key using converter ...
@Khitiara
Khitiara / Coroutine.cs
Last active January 25, 2022 00:51
AsyncCorountines
using System.Runtime.CompilerServices;
namespace Track.Ties;
public static class Coroutine
{
public static YieldAwaitable Yield() => Task.Yield();
public static DelayAwaitable Delay(TimeSpan timeSpan) => new(timeSpan);
@Khitiara
Khitiara / NOTES.md
Created April 23, 2021 22:54
rusty tcas maybe
  • requires msfs-rs 34db965 or later
  • fetching craft title dependent on getting STRING256 support in msfs-rs but shouldnt be needed for tcas purposes (not sure if vatsim injects a title properly anyway), commented out for now
  • not sure how to integrate this with the existing a32nx systems, looking for any feedback or advice there (or if someone else wants to work on that)
  • numeric argument to request_data_on_sim_object_type is radius around player aircraft in meters.
  • request_id arbitrary but should be unique within the simconnect context
@Khitiara
Khitiara / Demo.cpp
Created April 22, 2021 18:24
tcas maybe proof-of-concept
// Copyright (c) Asobo Studio, All rights reserved. www.asobostudio.com
#include <MSFS\MSFS.h>
#include <MSFS\Legacy\gauges.h>
#include <SimConnect.h>
#include <stdio.h>
#include <iostream>
#include <string>

Keybase proof

I hereby claim:

  • I am Khitiara on github.
  • I am robotbrain (https://keybase.io/robotbrain) on keybase.
  • I have a public key whose fingerprint is E24F F92E 2E20 8A7E F59A 36DC 9949 BAC0 6599 F7CD

To claim this, I am signing this object:

{
"path": "ic2c/plants/hemp_plant.json",
"enabled": true,
"id": "hempic",
"plant_name": "Hemp",
"seed_name": "Hemp Seed",
"seed_items": [],
"description": {
"translations": {},
"default": ""