Skip to content

Instantly share code, notes, and snippets.


Michael Lamparski ExpHP

View GitHub Profile
ExpHP /
Last active Jun 3, 2021
use bstr::{BString};
use crate::meta;
use crate::var::{VarId};
use crate::ident::Ident;
use crate::pos::{Sp, Span};
use crate::error::CompileError;
use crate::type_system::{self, NameId};
// =============================================================================
ExpHP / gvs.ts
Last active Aug 27, 2020
GridViewScroll performance rewrite
View gvs.ts
* GridViewScroll performance rewrite
* Copyright (c) 2020 Michael Lamparski
* Based on GridViewScroll
* Copyright (c) 2017 Likol Lee
* Both are released under the MIT license:
* 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:
ExpHP /
Last active Jun 22, 2020

Completely random Touhou reversing notes

This is a wide variety of completely random stuff that I eventually wanted to put on webpages once they got fleshed out enough, but don't have the time to continue working on atm so I'm just dumping it all here

Most notably this has complete lists of on_tick priorities for almost every STG (just missing a few of the point titles like GFW and ISC)... not that there's much you can do with that information.

Early reversing:

(this section is just personal notes describing what to do early on, because I still need to do this for ISC and GFW)

#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
import as cm
import matplotlib as mpl
x = np.linspace(0, 10, 500)
y = np.cos(x)
value = 10 * np.cos(x / 3)
alpha = y**2
ExpHP /
Last active Oct 12, 2020
AnmManager and TH17 1.00b

The ANM manager

TH16 can crash when a large number of enemies and bullets/lasers are destroyed, ruining some score runs. Notably, TH17 1.00a can also crash, but the bug was finally fixed in 1.00b.

Motivated by wanting to understand this crash and perhaps repair it for TH16, I made my best effort to look into the changes between TH17 1.00a and 1.00b. I have not yet figured out the true cause of the crash, but my efforts to discover the cause have forced me to understand even more about how ANMs work.
(Edit 2020/10/07: The reason for the crash is now known!)

Thanks to this, I have now mapped out a significant portion of AnmManager, the single largest struct ever allocated by the game.

The AnmManager structure

ExpHP /
Last active Apr 18, 2020
1st spell timing data

Time to capture for first spell in TH16 versus TH17

Data collected to determine scaling of DPS between these games.

Fair warning: This was done pretty sloppily. Only one trial per data point. The spells are ones where the boss can move; I chased them down as well as I could. (also played on Easy to make dodging easier).

TH16 timings on first spell at 3 season level (spell has 1700 life)

Char Spring Summer Fall Winter
from gpaw import GPAW, PW
from ase import Atoms
from phonopy import Phonopy
from phonopy.structure.atoms import PhonopyAtoms
from phonopy.phonon.band_structure import get_band_qpoints_and_path_connections
from import read_vasp
import phonopy
import sys
import shutil
ExpHP /
Last active Sep 2, 2020
anm parser info

Announcement regarding this gist

Much of the information here is old and outdated!

Visit my new site at

ExpHP /
Last active Mar 1, 2020
erased deserialize
use std::marker::PhantomData;
use std::any::Any;
use erased_serde::{Error, Deserializer};
use serde_json::json;
/// Dummy type that concretely represents "an impl of Deserialize".
/// If you want to deserialize arbitrary types, you'll have to create a
/// `DeserializeImpl<T>` in a portion of code that knows which type needs to
/// be deserialized, and then unsize it to `dyn DeserializeOwned` to be handed