Skip to content

Instantly share code, notes, and snippets.

View ExpHP's full-sized avatar

Michael Lamparski ExpHP

View GitHub Profile
@ExpHP
ExpHP / asimov.md
Last active March 10, 2022 01:45
Brian Dunder (Asimov)

Brian Dunder

thing wants doctor hall

could get doctor hall's influence by showing technology or offering to help

New appearance

normal:

@ExpHP
ExpHP / 0-README.md
Last active May 20, 2019 23:46
Kittens Game Eyestrain Reducer

Kittens Game Eyestrain Reducer

For Kittens Game Ver 1.4.6.1

Preview Classic Preview Dark Preview Grassy

@ExpHP
ExpHP / cargo-unused.py
Created April 3, 2019 17:06
cargo-unused
#!/usr/bin/env python3
import pytoml as toml
import argparse
import subprocess
import sys
def main():
p = argparse.ArgumentParser('cargo-unused')
# TODO: Should have an --all flag that detects unused deps on all crates in a workspace
diff --git a/crates.d/crates.toml b/crates.d/crates.toml
index d5c2351..480de2a 100644
--- a/crates.d/crates.toml
+++ b/crates.d/crates.toml
@@ -85,3 +85,4 @@ lammps-sys = { tag = "v0.3.0", git = "https://github.com/ExpHP/lammps-sys" }
rayon = "0.8"
vasp-poscar = "0.1.1"
path_abs = { rev = "72c767cfabe27", git = "https://github.com/vitiral/path_abs" }
+frunk = "0.1.36"
diff --git a/crates.d/rsp2-tasks.Cargo.toml b/crates.d/rsp2-tasks.Cargo.toml
@ExpHP
ExpHP / index-traits.rs
Last active July 30, 2018 01:24
crazy index polymorphism
/// Either `[X]` (for `I = usize`) or `Indexed<I, [X]>`.
pub type SliceType<I, X> = <() as IndexFamily<I, X>>::Slice;
/// Either `Vec<X>` (for `I = usize`) or `Indexed<I, Vec<X>>`.
pub type OwnedType<I, X> = <() as IndexFamily<I, X>>::Owned;
/// Can be used to retrofit support for Indexed into old vec/slice-based interfaces.
///
/// The associated types `Slice` and `Owned` are `[X]` and `Vec<X>` for `I = usize`,
/// and `Indexed<I, _>` for anything else. That makes them suitable for retrofitting
@ExpHP
ExpHP / perm.rs
Created July 12, 2018 16:41
Perm and Permute
/* ************************************************************************ **
** This file is part of rsp2, and is licensed under EITHER the MIT license **
** or the Apache 2.0 license, at your option. **
** **
** http://www.apache.org/licenses/LICENSE-2.0 **
** http://opensource.org/licenses/MIT **
** **
** Be aware that not all of rsp2 is provided under this permissive license, **
** and that the project as a whole is licensed under the GPL 3.0. **
** ************************************************************************ */
@ExpHP
ExpHP / shift-invert-bad-results.txt
Created June 15, 2018 20:31
shift invert bad results
$ python3
Python 3.6.5 (default, May 11 2018, 04:00:52)
[GCC 8.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> d=json.load(open('gamma-dynmat.json'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'gamma-dynmat.json'
>>> d=json.load(open('whyyyyyyy-091-a/gamma-dynmat.json'))
>>> list(d)
@ExpHP
ExpHP / 0_toc.md
Last active June 7, 2018 22:48
lammps-logs

Table of contents

Each file is a lammps log from computing forces at 124 displacements. Each structure has a single atom displaced 1e-3 angstroms from its equilibrium position.

Abbreviated logs show only the energy lines.

@ExpHP
ExpHP / index_cast.rs
Created June 5, 2018 19:10
index_cast.rs
/* ************************************************************************ **
** This file is licensed under EITHER the MIT license or the Apache 2.0 **
** license, at your option. **
** **
** http://www.apache.org/licenses/LICENSE-2.0 **
** http://opensource.org/licenses/MIT **
** ************************************************************************ */
use ::Idx;
use ::std::marker::PhantomData;
pub mod id_hash {
use ::std::collections::{HashSet, HashMap};
use ::std::hash::{Hasher, BuildHasherDefault};
/// Hashes u64s to themselves, assuming they already come from
/// a uniform distribution.
///
/// THIS IS PROBABLY A BAD IDEA.
#[derive(Debug, Default)]
pub struct IdHasher(Option<u64>);