Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@backwardspy
backwardspy / game.py
Created November 25, 2021 18:30
pyxel level loading example
from typing import Optional
from dataclasses import dataclass
import pyxel
@dataclass(frozen=True)
class Wall:
loc: tuple[int, int]
@backwardspy
backwardspy / ksp-stockplus.ckan
Last active January 5, 2022 18:16
kerbal space program mods that improve gameplay and visual fidelity, without fundamentally changing the game. the pack is in ckan format, but you can just use the `depends` list to install manually if you prefer.
{
"spec_version": "v1.18",
"identifier": "KSP-StockPlus",
"name": "KSP Stock+",
"abstract": "Mods that improve gameplay and visual fidelity, without fundamentally changing the game.",
"author": [
"backwardspy"
],
"version": "v1.0",
"license": [
"""
How many distinct haikus are there in a language with 16 one-syllable words, 22 two-syllable words,
11 three-syllable words, 5 four-syllable words and 1 five-syllable word, assuming a haiku is simply
a set of words following the 5/7/5 format.
"""
import math
def constrained_partitions(n, k, min_elem, max_elem):
"""
@backwardspy
backwardspy / betterpid.lua
Created August 17, 2022 12:42
a much better pid for stormworks that avoids integral windup
-- a much better pid that avoids integral windup
-- set these to your liking
local kp = 0.05
local ki = 0.005
local kd = 0.0
-- only update integral when abs(error) is within this threshold
local ithresh = 5.0
-- don't fiddle with these
use std::collections::HashMap;
use tera::{to_value, try_get_value, Context, Error, Tera, Value};
#[derive(Debug, serde::Serialize, serde::Deserialize)]
struct Hsl {
h: f64,
s: f64,
l: f64,
}

aspe:keyoxide.org:HWCHT25NNHGR2YDFZWD3DHYSOU