Skip to content

Instantly share code, notes, and snippets.

import time
import numpy as np
from numba import njit
from scipy.optimize import minimize
SQRT_2PI = np.sqrt(2 * np.pi)
def ldnorm(x, mu, sd):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@smason
smason / model fitting.ipynb
Last active April 30, 2021 19:20
cooling water
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.
from types import CodeType, FunctionType
from dis import dis
def patch(fn, name, codestring):
code = fn.__code__
code = CodeType(
code.co_argcount, code.co_posonlyargcount, code.co_kwonlyargcount,
code.co_nlocals, code.co_stacksize, code.co_flags, codestring,
code.co_consts, code.co_names, code.co_varnames,
code.co_filename, name, code.co_firstlineno, code.co_lnotab,
@smason
smason / mules.ini
Created April 25, 2018 17:58
Using uWSGI Mules and Farms to prioritise background work
[uwsgi]
http = :8000
wsgi-file = mules.py
need-app = true
master = true
enable-threads = true
processes = 2
mules = 5
farm = limited:1
harakiri = 120
@smason
smason / .babelrc
Last active February 6, 2018 00:53
playing with async paging
{
"presets": ["es2015"]
}
@smason
smason / keybase.md
Created February 11, 2017 21:02
keybase proof

Keybase proof

I hereby claim:

  • I am smason on github.
  • I am samason (https://keybase.io/samason) on keybase.
  • I have a public key whose fingerprint is FF49 FE33 E915 BD4F 8A9E 0546 5B78 5912 85BB 94DF

To claim this, I am signing this object: