Skip to content

Instantly share code, notes, and snippets.

View ExpHP's full-sized avatar

Michael Lamparski ExpHP

View GitHub Profile
@ExpHP
ExpHP / erased-deserialize.rs
Last active March 1, 2020 08:05
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
@ExpHP
ExpHP / dyre-intro.md
Last active January 31, 2020 16:45
Dyre intro

A commoner, human, cautiously walks down the street at nightfall holding a lantern, keeping an eye out for thieves. Suddenly, a voice booms from towards the city gates.

"CANDLE BEARER! Where are your vestments!"

The camera shifts to a glowing light in the distance, moving, growing nearer until it reveals itself to be a shield. The light from the shield partially illuminates the bearer: 4 and a half feet at best, and with a long, scraggly beard ending in a vaguely triangular shape at breast level. Clearly, a dwarf. It presses its face forward a slight bit so that the light from the shield reveals the stern look in its eyes.

The commoner breathes a heavy sigh. Oh, no. Not again.

The verbal onslaught continues. "That light is a blessing to us from ______, who you blaspheme by carrying it so thoughtlessly!"

@ExpHP
ExpHP / intcode.rs
Created December 24, 2019 04:36
Rusty intcode
use thiserror::Error;
use std::convert::{TryFrom, TryInto};
use std::collections::{VecDeque, HashMap};
use std::path::Path;
//==============================================================================
/// Represents an Intcode code file.
#[derive(Debug, Clone)]
pub struct Intcode {
@ExpHP
ExpHP / unfolding.md
Last active December 11, 2019 18:21
unfolding notes

Unfolding requirements

Unfolding the eigenvectors at a given K

  • We must define a superlattice and sublattice.  Following physics naming convention, the superlattice corresponds to a supercell, making it a subgroup of the sublattice.

  • We need the 3N eigenstates computed at a point K in the supercell FBZ.

  • The rest of the details will depend significantly on the data format used to represent eigenstates. (For phonons, these are 3N-dimensional eigenvectors defining a 3-vector at each atom.)

@ExpHP
ExpHP / molotov.md
Last active December 4, 2019 03:53
Molotov

Molotov

  • Shrewd: +2
  • Swift: +1
  • Strong: 0
  • Steady: -1

Panic:

  • 1 Panic
@ExpHP
ExpHP / math-is-bad.md
Last active October 28, 2019 03:46
crazy-reddit-math-is-bad

Somebody spammed the following to a bajillion subreddits for different universities (just changing the name of the university in the first sentence). Most copies have been deleted, but it is preserved here for the fossil record


Why study maths at Lehigh University when they dont teach you that it is proven maths ends in meaninglessness/contradiction: 6 proofs/examples

http://gamahucherpress.yellowgum.com/wp-content/uploads/MATHEMATICS.pdf

http://gamahucherpress.yellowgum.com/wp-content/uploads/All-things-are-possible.pdf

@ExpHP
ExpHP / cartesian.rs
Created September 8, 2019 16:48
cartesian product macro
/// Higher-order macro that iterates over a cartesian product.
///
/// Useful for generating impls involving opaque traits of the sort
/// sometimes seen used as bounds in public APIs.
///
/// It takes a number of groups of token trees and a suitable definition
/// for a callback macro, and it calls the macro with one token tree from
/// each group in order.
///
/// See the examples module in the source for example usage.
@ExpHP
ExpHP / gist:ca21d96a062fbf8aa6bab4d830d64cf1
Last active November 28, 2020 02:06
Jet (Tony Stuart)

Tony Stuart

Status: Body beaten and unconscious, now currently just controlling a Jet Mason (which just looks like a shirtless Mason)

Idea: Prevent Weaver from escaping by getting a mental tether to him and sending water along it to flood his subconscious

Reminder: You have an uber powerful Joined move!

Game info

# This is crates.d/crates.toml
# Master config file for crates in this workspace.
#
# This is a homegrown solution (I'm sorry) to a number of
# annoying problems with using workspaces. Cargo.toml files
# in this workspace are generated from source files that
# contain lines like this:
#
# !!rsp2-assert-close
import networkx as nx
from collections import defaultdict
import itertools
import planarity
def graph_from_adj(adj):
G = nx.Graph()
for (src, edges) in enumerate(adj):
for dest in edges:
G.add_edge(src, dest)