Skip to content

Instantly share code, notes, and snippets.

View lashtear's full-sized avatar

Emily Backes lashtear

View GitHub Profile
@lashtear
lashtear / BTW.hs
Created April 25, 2023 00:54
a tiny (and slow) Burrows-Wheeler Transform in Haskell
module BWT where
import Data.List (sort)
ibwt :: String -> String
ibwt s =
let len = length s
cs = cycle s in
head $
head $
@lashtear
lashtear / hello.asm
Created August 26, 2020 00:49
hello world z80 nsadv
;; constants in the rom
romcout:equ 087fdh ; draw-character routine
romfont:equ 08561h ; built-in compressed 8x10 font
;; bootloader always jumps to loadaddr+10
bsent: equ 0c00ah
org 0c000h ; start at 0c000h
db 0c0h ; tell bootloader to load at 0c000h
ds bsent-$ ; skip to the 0c00ah entry point
@lashtear
lashtear / keybase.md
Created February 13, 2019 02:24
keybase statement

Keybase proof

I hereby claim:

  • I am lashtear on github.
  • I am lashtear (https://keybase.io/lashtear) on keybase.
  • I have a public key ASAHm-qxXzsv2V4wCTdeog92pMn_M3VDDvGNfpOrXW1eoQo

To claim this, I am signing this object:

// 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
---- 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)
---- 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)
@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)
#! /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 / 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
@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