Skip to content

Instantly share code, notes, and snippets.

View ParadoxV5's full-sized avatar
🎮

ParadoxV5

🎮
View GitHub Profile
@ParadoxV5
ParadoxV5 / MariaDB-server Standard Library.md
Last active October 31, 2025 04:42
[WIP] `MariaDB/server`’s Standard Library and comparison with C++’s

MariaDB is primarily written in C++. — or are we? Hah, you will be surprised with how little C++ features we use.

MariaDB/server’s Standard Library and comparison with C++’s

my_global.h

TODO: https://jira.mariadb.org/browse/MDEV-35460

@ParadoxV5
ParadoxV5 / await_await.gd
Created October 21, 2025 20:13
await await await await
extends Timer
func await_await() -> Signal:
print("await signal")
await timeout
print("await return")
return timeout
func _enter_tree() -> void:
print("await start")
@ParadoxV5
ParadoxV5 / git config push.default.md
Created October 15, 2025 04:26
`git push` defaults

git push defaults

Here, I will call the currently-checked-out (HEAD) local branch as simply the current branch.

The Default Repository

If the repo is omitted, git push searches the following configs and uses the first one configured:

  1. branch.<current branch>.pushRemote
  2. remote.pushDefault
  3. branch.<current branch>.remote

The Default Refspec

@ParadoxV5
ParadoxV5 / ≠ and ≶ are different.md
Created August 17, 2025 03:42
≠ and ≶ are different.

Today, I realized that != and <> can be different.

Of course, they are equivalent in the ideal domain, but we live in a polymorphic world where two values can be incomparable with each other. For example, 1, a number, is incomparable to "Hello", a string of text. This relation is mathematically known as a Partial Ordering.

Arguably, "Hello" doesn’t literally equal one, which we can denote as "Hello" ≠ 1. On the other hand, "Hello" ≶ 1 doesn’t quite hold. Their mutual incomparability means that neither is less or greather than the other; it would instead be "Hello" ≸ 1.

@ParadoxV5
ParadoxV5 / My Containers.rbs
Created July 19, 2025 02:10
Concepts of a Containers Std.Lib.
# Basics
module Container[V, E = V]: _Container[V, E]
include Enumerable[E]
interface _Container[V, E = V]
def self.from: (Enumerable[E] other) -> instance
def include?: (V value) -> bool
def add?: (E entry) -> E?
@ParadoxV5
ParadoxV5 / C++ Type Array.cpp
Created July 17, 2025 04:32
C++ Compile-time Fixed-Size Array of Types
#include <cstdint>
#include <tuple>
#include <type_traits>
#include <iostream>
using std::size_t;
/** Compile-time Fixed-Size Array of Types */
template<typename... T> struct TypeArray {
using TupleType = std::tuple<T...>;
template<size_t i> using At =
#include <stddef.h>
#include <stdint.h>
/**
Here is my Standard-compliant, SIMD-capable version of
https://pzemtsov.github.io/2016/11/06/bug-story-alignment-on-x86.html.
I wonder which one is faster in a benchmark?
*/
_Bool check_ip_header_sum(const char *p, size_t size)
{
#include <optional>
#include <cstdio>
int main() {
std::optional<int> optional_of_none(std::nullopt);
std::optional<std::optional<int>> optional_of_optional(optional_of_none);
std::printf(
"optional_of_none.has_value():\t%d\n"
"optional_of_optional.has_value():\t%d\n",
@ParadoxV5
ParadoxV5 / golf.rb
Created May 14, 2025 01:51
Sow and Tell – Ruby Discord Mother’s Day 2025 challenge
puts$*[0].gsub(/(.)\1*/){'_🌷🌼🪻'[it.size]+$1}
@ParadoxV5
ParadoxV5 / null_lambda.cpp
Created February 28, 2025 05:03
Yes, there are null lambdas in C++!
// Lambda is a type of *value*, and *values* can’t be null.
// But y’know what can? *References* to values.
#include <functional>
#include <stdio.h>
const auto lambda = [] () -> const char* {
return "Hello from lambda!";
};