Skip to content

Instantly share code, notes, and snippets.

View apples's full-sized avatar
🏳️‍🌈

Apples apples

🏳️‍🌈
View GitHub Profile
@apples
apples / LICENSE.txt
Last active January 3, 2024 00:22
Wave Function Collapse implementation in pure GDScript
MIT License
Copyright (c) 2024 Apples
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
furnished to do so, subject to the following conditions:
@apples
apples / dice_roll.gd
Last active September 26, 2023 05:19
GDScript Dice Notation Parser and Calculator
class_name DiceRoll
extends RefCounted
## Usage
## [codeblock]
## var dice := DiceRoll.new("1d4 + 2 * X")
## if not dice.is_valid():
## print("Invalid dice.")
## print("Range: %s ~ %s" % [dice.min(), dice.max()])
## print("Sample roll: %s" % [dice.roll({ X = 2 })])
@apples
apples / android_godot.md
Last active September 24, 2023 07:23
A tutorial on setting up the Godot 4.0 editor on Android with Git and Termux.

Godot Editor on Android

Overview

This tutorial is designed to set up a complete Git workflow on Android, complete with LFS, and use it with the Godot editor.

The storage usage is minimal.

Be prepared to get a bit technical. You should be familiar with command line tools,

@apples
apples / CopperSession.cs
Last active December 10, 2021 04:54
Copper Token - cryptographically secure tokens for ASP.NET Core WebAPI.
using System;
using System.Security.Claims;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
namespace Copper
{
public static class CopperSession
{
@apples
apples / Copy.cs
Last active December 9, 2021 23:04
C# Shallow copy function
using System;
using System.Reflection;
namespace Mealplan
{
public static class Copy
{
public static T Shallow<T>(object src, Type? srcType = null, object? defaultValues = null, object? forceValues = null)
where T : new()
{
@apples
apples / stir_fry.md
Last active June 6, 2021 19:04
Ol' Appelli's Texas Stir Fry

Ol' Appelli's Genuine Texas Stir Fry

A pretty easy recipe once you get the hang of it, but requires a few unusual items that you likely don't have laying around.

Works better on a traditional flame wok, but a modern stovetop wok works just as well. Just keep in mind that non-stick woks are not designed to sit at extremely high temperatures, so don't let it get too crazy hot in the preheating phase.

I recommend using a spatula designed for woks (these usually have a bit more of a "spoon" shape to them), but if you don't have one then use a wooden spoon works well enough.

@apples
apples / powershell_app_executable.md
Last active March 31, 2021 20:40
PowerShell 4 Dummies - Chapter 69: Obtaining info about an app package

Firstly, a "package" is a collection of files, and may contain multiple "applications", which are the executables.

You can list the details about the package with Get-AppxPackage, as discussed.

PS C:\Users\dbral> $pkg = get-appxpackage -name *terminal*
PS C:\Users\dbral> $pkg


Name : Microsoft.WindowsTerminal
@apples
apples / pack_quaternion.hpp
Created March 24, 2021 19:58
Quaternion (un)packing function, smallest-three representation.
#pragma once
#include <glm/gtc/quaternion.hpp>
#include <cassert>
#include <cmath>
#include <cstdint>
/** Creates smallest-three packing of quaternion, 10 bits per component */
inline auto pack_quaternion(glm::quat q) -> std::uint32_t {
@apples
apples / lock_free_queue.hpp
Created November 29, 2020 10:14
Easy peasy lock-free queue
#pragma once
#include <atomic>
#include <optional>
template <typename T>
class lock_free_queue {
public:
using value_type = T;