-
Don't open the repo in vscode with the c/c++ extension enabled, it will hoard enormous amounts of resources.
-
Be sure to build
clr+libs
in Debug the first time; then you can
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
// --- popcnt as a C integer constant expression --- | |
// this is the kinda bullshit required when you can't use C++ >:| | |
#define __const_popcnt2(val) ((val) == 0 ? 0 : ((val) == 2 ? 2 : 1)) | |
#define __const_popcnt4(val) (__const_popcnt2((val) & 0b11) + __const_popcnt2((uint8_t)((val) & 0b1100) >> 2)) | |
#define const_popcnt8(val) (__const_popcnt4((val) & 0b1111) + __const_popcnt4((uint8_t)(val) >> 4)) | |
#define const_popcnt16(val) (const_popcnt8((val) & 0b11111111) + const_popcnt8((uint16_t)(val) >> 8)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<!-- ...normal msbuild stuff... --> | |
<PropertyGroup> | |
<PackageId>YOUR.GENERATOR.NAME</PackageId> | |
<Version>0.1</Version> <!-- Actual release version --> | |
<!-- Ensure dynamic verison is only visible to normal builds | |
and not the IDE --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.CompilerServices; | |
/// <summary> | |
/// Computes various properties of <typeparamref name="TEnum"/> | |
/// </summary> | |
/// <remarks>WARNING: This assumes that <typeparamref name="TEnum"/>'s underlying type is an <see langword="int"/></remarks> | |
public static class EnumInfo<TEnum> where TEnum : struct, Enum | |
{ | |
private static readonly Lazy<HashSet<TEnum>> _valuesSet = new(static () => new HashSet<TEnum>(EnumValues!)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
static class SpanExtensions | |
{ | |
// just a quick and dirty version, could be a lot faster | |
// by just using Vector<byte>.Shuffle if available | |
public static void Reverse4ByteEndianness(Span<byte> bytes) { | |
byte b0, b1, b2, b3; | |
for (int i = 3; i < bytes.Length; i += 4) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* MIT License | |
* | |
* Copyright (c) 2022 blokyk | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function center_txt() { | |
txt=$1 | |
line_nb=$(wc -l <<< $txt) | |
available_lines=$(($(($LINES - $line_nb)) / 2)) | |
#echo $available_lines | |
#echo "$txt" | |
perl -E "say \"\n\" x $available_lines" | |
#echo $top | wc -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pay attention to the scaling ! | |
// Some results might look boring or glitchy from afar (or close), but don't fret ! | |
// p.x and p.y are current coordinates | |
// v.x and v.y is a velocity at point p | |
// https://bit.ly/3bmvQ58 -- zoomed in | |
vec2 get_velocity(vec2 p) { | |
vec2 v = vec2(0., 0.); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Flags] | |
public enum ValidOn { | |
Edge = 0, | |
EdgeNode = Edge & Node, | |
EdgeNodeGraph = EdgeNode & Graph, | |
EdgeNodeGraphSubgraph = EdgeNodeGraph & Subgraph, | |
EdgeNodeGraphSubgraphCluster = Edge & Node & Graph & Subgraph & Cluster, | |
EdgeNodeGraphCluster = EdgeNodeGraph & Cluster, | |
EdgeNodeSubgraph = EdgeNode & Subgraph, | |
EdgeNodeSubgraphCluster = EdgeNodeSubgraph & Cluster, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Colors { | |
AliceBlue, | |
AntiqueWhite, AntiqueWhite1, AntiqueWhite2, AntiqueWhite3, AntiqueWhite4, | |
Aqua, | |
AquaMarine, AquaMarine1, AquaMarine2, AquaMarin3, AquaMarine4, | |
Azure, Azure1, Azure2, Azure3, Azure4, |
NewerOlder