Skip to content

Instantly share code, notes, and snippets.

View lashtear's full-sized avatar

Emily Backes lashtear

View GitHub Profile
#! /usr/bin/perl
use warnings;
use strict;
sub slurp {
my $filename = shift;
local $/;
open my $fh, '<', $filename
or die "open: $filename: $!\n";
{-# OPTIONS -Wall #-}
module Creepsay where
-- ^ This file has some random scribblings for Screeps Diplomacy
-- protocol discussion. Most of the things in here are not directly
-- of use, but might help for assembling reference examples, once we
-- figure out how the various layers should work.
--
-- The 62k suffix entries are "base62k" encoding, i.e. using all of
-- the UCS2 space except for the 0xd800-0xdfff region historically
@lashtear
lashtear / reactor.lua
Created March 14, 2017 09:08
Darklight's reactor pid stuff
local component = require("component")
local computer = require("computer")
function getPIDObject(kp, ki, kd, minclamp, maxclamp, inputMethod, outputMethod)
local retObj = {}
retObj.kp = kp
retObj.ki = ki
retObj.kd = kd
retObj.minclamp = minclamp
retObj.maxclamp = maxclamp
@lashtear
lashtear / Delaunay.hs
Created August 2, 2017 22:36
My old 2D Delaunay/Voronoi tessellation tools
{-# LANGUAGE TupleSections #-}
module Delaunay where
import qualified Data.Function as F
import qualified Data.List as L
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.Set (Set)
import qualified Data.Set as Set
@lashtear
lashtear / pid.kt
Created August 3, 2017 08:35
pid controller changes for output and integral clamping
override fun process(inputs: Array<Double?>, deltaTime: Double): Double {
val error = (inputs[0] ?: 0.0) - (inputs[1] ?: 0.0)
val deltaError = error - lastError
lastError = error
errorIntegral += error * deltaTime
val result = Kp * error + Ki * errorIntegral + Kd * deltaError / deltaTime
if (Ki > 0 && (result > 50.0 || result < 0.0)) {
val clamp = Math.max(Math.min(result,50.0),0.0)
errorIntegral = (clamp-Kp*error-Kd*deltaError/deltaTime)/Ki
return clamp
#! /usr/bin/python3
# small helper script for bundling up factorio mods redistributable
# under BSD3 or MIT terms as desired
import json
import subprocess
with open("info.json") as info_file:
info = json.load(info_file)
@lashtear
lashtear / bpp.hs
Created September 16, 2018 02:06
I solemnly swear I'm up to no good.
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
module Main where
import Prelude (IO, return, undefined)
---- Minecraft Crash Report ----
// Sorry :(
Time: 12/12/18 7:56 PM
Description: Ticking memory connection
cpw.mods.fml.relauncher.ReflectionHelper$UnableToFindMethodException: java.lang.NoSuchMethodException: net.minecraft.client.multiplayer.PlayerControllerMP.k()
at cpw.mods.fml.relauncher.ReflectionHelper.findMethod(ReflectionHelper.java:187)
at ru.denull.BugPatch.mod.ClientEvents.blockBreak(ClientEvents.java:33)
at cpw.mods.fml.common.eventhandler.ASMEventHandler_59_ClientEvents_blockBreak_BreakEvent.invoke(.dynamic)
---- Minecraft Crash Report ----
// Shall we play a game?
Time: 12/16/18 2:55 PM
Description: Unexpected error
java.lang.ArrayIndexOutOfBoundsException: 1
at tconstruct.smeltery.logic.SmelteryLogic.heatItems(SmelteryLogic.java:466)
at tconstruct.smeltery.logic.SmelteryLogic.func_145845_h(SmelteryLogic.java:307)
at tconstruct.smeltery.logic.SmelteryLogic.func_70296_d(SmelteryLogic.java:705)
// assumptions
// va - dbref of the hook object
// vb - dbref of the command object
// _posebreak - per-user attr for posebreak on/off before/after
// defaults to 00 (off/off)
// posebreak - per-user function for posebreak content
// defaults to %r (a blank line)
// posebreak - before