Skip to content

Instantly share code, notes, and snippets.

View howardjp's full-sized avatar

James Howard howardjp

View GitHub Profile
@howardjp
howardjp / qm-emacs.org
Last active August 22, 2023 22:28
Some light quantum mechanics in Emacs Lisp

Quantum Mechanics for Engineers

Problem 1

Find the fringe spacing in double-slit experiment where a particle is an electron at 1 MeV, and other values included below.

@howardjp
howardjp / run-sepsis.py
Last active January 16, 2022 18:20
patch for NeuralCDE
import sepsis
sepsis.run_all(intensity=True, device='cuda')
sepsis.run_all(intensity=False, device='cuda')
@howardjp
howardjp / torchcde-demo-time-series-classification.ipynb
Last active March 11, 2021 14:58
TorchCDE Demo - Time Series Classification.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@howardjp
howardjp / mcpi.rs
Created January 2, 2019 21:06
Monte Carlo Pi Estimate in Rust
extern crate rand;
use rand::Rng;
fn montecarlo_pi(trials: u32) -> f64 {
let mut count: u32 = 0;
let mut rng = rand::thread_rng();
for _i in 1..trials {
let x: f64 = rng.gen::<f64>();
@howardjp
howardjp / ggplot-dcchoice.R
Created November 26, 2018 14:59
This is a mostly ggplot-ish implementation of the plot for dbchoice and sbchoice models in the DCchoice package.
### This is a mostly ggplot-ish implementation of the plot for dbchoice
### and sbchoice models in the DCchoice package.
ggplot.dbchoice <- function(x, ...) {
minbid <- min(x$bid)
maxbid <- max(x$bid)
bidseq <- seq(minbid, maxbid, by = (maxbid - minbid) / 100)
b <- x$coefficients
npar <- length(b)
@howardjp
howardjp / 0x18358791.asc
Last active November 13, 2018 18:29
James Howard's public key (jh@jameshoward.us)
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEVoAa3xYJKwYBBAHaRw8BAQdAjmFdyF84L4mnsxlWQePC1nlWmCfvFa/AnA7L
cSFSrJG0GEphbWVzIFBhdHJpY2sgSG93YXJkLCBJSYh8BBMWCgAkAhsBBQsJCAcD
BRUKCQgLBRYCAwEAAh4BAheABQJYErV1AhkBAAoJEH4a3z4YNYeRVuwBAKFslfxr
/fWgttA4m6/AQ7FJ0APdOyMDRbm/b4ZJEJ8eAP478Bla7UMZgzYhQ5hQs9qFlNKd
hh5BfYMqVZnKKLnSA7QsSmFtZXMgUGF0cmljayBIb3dhcmQsIElJIDxqaEBqYW1l
c2hvd2FyZC51cz6IeQQTFgoAIQUCVoAcVwIbAQULCQgHAwUVCgkICwUWAgMBAAIe
AQIXgAAKCRB+Gt8+GDWHkUxPAQCPuEdmr9Dq/Y6z1iMWGk3v17PzcJQhzcCIw+bP
oC0SEwD7BRCwvIRETDDK226t1toDmUJ6EQ5yo5BmqD9BEQ1g+gO0L0phbWVzIFBh
@howardjp
howardjp / bootCI.R
Last active November 15, 2018 01:37
Parallel implementation of bootCI for the R DCchoice package
## Computing a bootsrap confidence interval
bootCI.parallel <- function (obj, nboot = 1000, CI = 0.95, individual = NULL, threads = 1) {
## Manage any potential incorrect inputs, error out as approrpiate
if(!inherits(obj, c("sbchoice", "dbchoice", "oohbchoice")))
stop("the object must be sbchoice, dbchoice, or oohbchoice class")
if(CI > 1 | CI < 0)
stop("CI must be between 0 and 1")
if(!is.null(threads) && !is.numeric(threads))
stop("threads must be an integer or NULL for autodetection")
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@howardjp
howardjp / MarylandCountyLegislatures.csv
Created October 29, 2018 13:01
Maryland Legislatures Analysis
County GovernmentType Population2010 LegislatorCount AnalyticTarget
Allegany Code Home Rule 75087 3 FALSE
Anne Arundel Charter 537656 7 FALSE
Baltimore City Charter 620961 15 FALSE
Baltimore County Charter 805029 7 FALSE
Calvert Commissioners 88737 5 FALSE
Caroline Code Home Rule 33066 3 FALSE
Carroll Commissioners 167134 5 FALSE
Cecil Charter 101108 5 FALSE
Charles Code Home Rule 146551 5 FALSE