Skip to content

Instantly share code, notes, and snippets.

View Caellian's full-sized avatar

Tin Švagelj Caellian

View GitHub Profile
@Caellian
Caellian / DependentOption.cmake
Last active January 9, 2025 19:07
CMake modules
# Distributed under the MIT/Apache 2.0/zlib License.
# Author: Tin Švagelj (Caellian) <[email protected]>
#[[.md:
# DependentOption
```cmake
dependent_option(
<option> "<help_text>" [<initial_value>]
[DEPENDS <conditions>]
@Caellian
Caellian / nvml.h
Created December 19, 2024 20:30
From Arch cuda SDK 12.6.3-1
/*
* Copyright 1993-2024 NVIDIA Corporation. All rights reserved.
*
* NOTICE TO USER:
*
* This source code is subject to NVIDIA ownership rights under U.S. and
* international Copyright laws. Users and possessors of this source code
* are hereby granted a nonexclusive, royalty-free license to use this code
* in individual and commercial software.
*
type ResultObject<Ok, Err> =
| { ok: true; value: Ok }
| { ok: false; value: Err };
export class Result<Ok, Err> {
private valueIsOk: boolean;
private value: Ok | Err;
constructor(value: ResultObject<Ok, Err>) {
this.valueIsOk = value.ok;
this.value = value.value;
@Caellian
Caellian / example.js
Last active November 29, 2024 03:47
Pino trace caller (Node)
pino({
mixin: (base, level, logger) => {
const result = {};
// allow manually specifying values
// for instance, error might want to point to a different file
if (base.file == null) {
let trace = callSite("project_name/index.js", "Pino.LOG");
Object.assign(result, {
method: trace.method,
...trace.path,
@Caellian
Caellian / trace.js
Last active November 28, 2024 19:54
JS stack trace parser
/**
* @typedef {object} LCPath
* @property {"eval" | string} file
* @property {number} [line]
* @property {number} [column]
*/
/**
* Parses a line-column path (e.g. "/some/file.txt:2:12"), into a computer
* friendly format.
@Caellian
Caellian / platform_info.c
Last active May 17, 2024 03:13
A tiny C program that prints out basic system information (build environment)
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if __has_include(<TargetConditionals.h>)
#include <TargetConditionals.h>
#endif
@Caellian
Caellian / A_option_list.md
Last active July 13, 2024 22:51
Dump of all Hades game console options
Option Value
/ResetRoomData bool
/ShowSocialLinks bool
/WindowY int
/SkipVideoCardTest bool
/SteamTrackpadMultiplier float
/LastUpdateDate std::string
/ZPassCullRadius float
/DirectLoadCheckpoint bool
@Caellian
Caellian / IncludeSubmodules.cmake
Created April 26, 2024 22:42
A CMake script that automatically fetches git submodules if they're not initalized
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
option(INIT_SUBMODULES "Check submodules during build" ON)
if(INIT_SUBMODULES)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(GIT_SUBMOD_RESULT EQUAL "0")
message(STATUS "Submodules initialized")
else()
@Caellian
Caellian / A - preview.md
Last active March 3, 2024 09:58
Animated grid background with houdini / 2D canvas API.

preview

@Caellian
Caellian / tones.sass
Created December 30, 2023 23:38
Pure CSS tone indicators.
$tones: "joke" "/j" "joking", "half-joke" "/hj" "half-joking", "sarcasm" "/s" "sarcastic", "genuine" "/g" "genuine", "serious" "/srs" "serious", "non-serious" "/nsrs" "non-serious", "positive" "/pos" "positive connotation", "neutral" "/neu" "neutral connotation", "negative" "/neg" "negative connotation", "copypasta" "/c" "copypasta", "lyrics" "/ly" "lyrics", "light-hearted" "/lh" "light-hearted", "not-mad" "/nm" "not mad", "nobody-here" "/nbh" "nobody here", "rhetorical" "/rh" "rhetorical question", "teasing" "/t" "teasing", "metaphore" "/m" "metaphorically", "literal" "/li" "literally", "hyperbole" "/hyp" "hyperbole", "fake" "/f" "fake"
span[data-tone]
display: inline
position: relative
&:before
display: inline-block
width: min-content
padding: 0 1ch
background: hsl(0,0%,15%)