Skip to content

Instantly share code, notes, and snippets.

View Kamillaova's full-sized avatar
🏳️

Kamilla 'ova Kamillaova

🏳️
View GitHub Profile
@mosra
mosra / README.md
Last active April 11, 2023 03:16
Most Obscure Features of C++
@ccbrown
ccbrown / DumpHex.c
Last active March 27, 2024 17:32
Compact C Hex Dump Function w/ASCII
#include <stdio.h>
void DumpHex(const void* data, size_t size) {
char ascii[17];
size_t i, j;
ascii[16] = '\0';
for (i = 0; i < size; ++i) {
printf("%02X ", ((unsigned char*)data)[i]);
if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') {
ascii[i % 16] = ((unsigned char*)data)[i];
@kvverti
kvverti / module.md
Last active June 24, 2023 01:48
The Fabric API Problem

Fabric API

Fabric API is supposed to be modular. This means that mod devs should be able to pick and choose which Fabric API modules to depend on in their mods, both in the development environment and in production.

Fabric API is also supposed to be just another mod. Fabric API should not have special support in Fabric tooling, nor should it be a required install for players. Basically, Fabric API is simply a collection of mostly independent modules that happen to be maintained by the same organization that maintains Fabric tooling.

The Problem

The fabric example mod contains a hard dependency on the entire Fabric API. Since most mod devs do not remove this dependency, most players have to download an additional mod (Fabric API) in order to play a Fabric mod, which many players do not expect. This means mod devs often assume that players have installed Fabric API in the production evnironment.

@HexedHero
HexedHero / mc_client_performance_guide.md
Last active July 22, 2024 01:04
Performance guide for Minecraft 1.20.6+ Clients

Performance guide for Minecraft 1.20.6+ Clients

📜 Fabric

Fabric is the "modern" Minecraft modding software that is very modular.
We use Fabric in this guide so install it by going to https://fabricmc.net/use/ Download the .jar or .exe and run it.

Below is a list of performance and utility mods to make your Minecraft experience better and most importantly smooth.
The list is in order of most importance and they all work together including what they do with why to use them.

@HolyMonkey
HolyMonkey / GravityScale.cs
Last active August 7, 2021 04:22 — forked from Priler/CubeController.cs
JumpManager.cs
using UnityEngine;
//Внезапно хауди списывая код с уроков забыл послушать что он означал
//В конечном итоге у него получился просто постоянный скейлинг гравитации
[RequireComponent(typeof(Rigidbody))]
class GravityScale : MonoBehaviour
{
[SerializeField] private float _scale = 10f;
private Rigidbody _self;
@udf
udf / write_up.md
Last active June 28, 2024 06:32
A Trick To Use mkMerge at The Top Level of a NixOS module

The Setup

I wanted to write a module that generates multiple systemd services and timers to scrub some zfs pools at certain intervals. The default scrub config does not support individual scrub intervals for each pool.

I want the config to look like this:

{
  services.zfs-auto-scrub = {
 tank = "Sat *-*-* 00:00:00";
@manveru
manveru / base64.nix
Created September 6, 2023 03:19
Encode to base 64 in pure Nix
{lib, ...}: {
toBase64 = text: let
inherit (lib) sublist mod stringToCharacters concatMapStrings;
inherit (lib.strings) charToInt;
inherit (builtins) substring foldl' genList elemAt length concatStringsSep stringLength;
lookup = stringToCharacters "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
sliceN = size: list: n: sublist (n * size) size list;
pows = [(64 * 64 * 64) (64 * 64) 64 1];
intSextets = i: map (j: mod (i / j) 64) pows;
compose = f: g: x: f (g x);