Skip to content

Instantly share code, notes, and snippets.

aspe:keyoxide.org:HWCHT25NNHGR2YDFZWD3DHYSOU

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,
}
@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
"""
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 / 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": [
@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]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
import time
from subprocess import Popen
VICE_PATH = os.getenv("VICE_PATH")
FFMPEG_PATH = os.getenv("FFMPEG_PATH")
BASIC = r'10 print"\xefRFCDE\xf7EDCFR\xef";:goto 10"\nrun\n'
@backwardspy
backwardspy / olccodejam2020_results.json
Last active September 20, 2020 19:42
Results of olcCodeJam2020 in JSON format
[
{
"title": "Pyomm",
"scores": [
{
"category": "Was this entry made during the jam duration?",
"rank": "#1",
"score": "5.000",
"raw_score": "5.000"
},
@backwardspy
backwardspy / reactor_control.lua
Created May 6, 2020 15:00
Extreme Reactors OpenComputers control script
--- CONFIG ---
-- minimum energy to store in the internal buffer as a fraction of the total
local BUFFER_MIN = 0.5
--- maximum energy to store in the internal buffer as a fraction of the total
local BUFFER_MAX = 0.8
--- END CONFIG ---
--- LIBRARIES ---
local component = require("component")