Skip to content

Instantly share code, notes, and snippets.

View console_output.log
File "C:\Users\stucc\Dropbox\src\daywalker\test\..\readme.md", line 86, in readme.md
Failed example:
history[['open', 'high', 'low', 'close', 'volume', 'divCash', 'splitFactor']]
Expected:
open high low close volume divCash splitFactor
date
2004-08-12 17.50 17.58 17.5 17.50 2545100 0.0 1.0
2004-08-13 17.50 17.51 17.5 17.51 593000 0.0 1.0
2004-08-16 17.54 17.54 17.5 17.50 684700 0.0 1.0
Got:
View azure_keyvault_configuration.py
import config
from azure.keyvault.secrets import SecretClient
from azure.identity import ClientSecretCredential
from azure.core.exceptions import ResourceNotFoundError
import time
class AzureKeyVaultConfiguration(config.Configuration):
"""
Configuration class.
@stucchio
stucchio / valuation_of_cash_flow_with_wealth_tax.py
Last active Oct 20, 2019
How to compute the valuation of a cash flow in the presence of a wealth tax.
View valuation_of_cash_flow_with_wealth_tax.py
import numpy as np
from numpy.linalg import solve
def vmat(n, discount_rate, tax_rate):
m = np.zeros(shape=(n,n))
discount = tax_rate*np.exp(-1*discount_rate*np.arange(n))
for i in range(n):
m[i, i:n] = discount[0:n-i]
m[i,i] = 1
return m
View keybase.md

Keybase proof

I hereby claim:

  • I am stucchio on github.
  • I am stucchio (https://keybase.io/stucchio) on keybase.
  • I have a public key ASA_kgAJceWD7PGBJvFyqObwCMqZDv2hcDqFPpdi8DrJvgo

To claim this, I am signing this object:

View cutoff_fake_bias
from scipy.stats import norm
from numpy import mean
x = norm(0,1).rvs(10000)
y = norm(1,1).rvs(10000) # Group Y is 1 standard deviation better than group X
print("Mean of group X, exceeding the cutoff: " + str(mean(x[x > 3]))) # Prints 3.22
print("Mean of group Y, exceeding the cutoff: " + str(mean(y[y > 3]))) # prints 3.40
View delayed_reaction.py
from pylab import *
from scipy.stats import uniform, binom, expon, beta
true_gamma = 0.5
N = 600
T = 15
data = zeros((2, N), dtype=float)
event_times = data[0,:]
event_times[:] = uniform(0,15).rvs(N)
View hiv_vs_guns.py
from pylab import *
hiv_infections = 29418
gun_homicides = 11078
gun_suicides = 19392
gun_deaths = gun_homicides + gun_suicides
hiv_qualys = array([22.9, 31.9])
hiv_qualys_discounted = array([9.34, 13.18])
@stucchio
stucchio / compass.py
Created Jan 8, 2016
Bayesian compass calibration script
View compass.py
from pylab import *
from scipy.stats import norm, uniform
theta_grid = arange(0,2*pi,1.0/1024.0)
true_b = pi/2
b_belief = ones(shape=theta_grid.shape, dtype=float)
b_belief /= b_belief.sum()
View quasimontecarlo.py
import ghalton
from pylab import *
from scipy.stats import gamma
def qmc_gamma(alpha, N):
M = len(alpha)
sequencer = ghalton.Halton(2*M)
valid = ones(shape=(N,), dtype=bool)
hs = array(sequencer.get(N)).transpose()
@stucchio
stucchio / Dockerfile
Created Nov 4, 2014
dockerfile for nginx reverse proxy
View Dockerfile
FROM ubuntu:14.04
MAINTAINER Chris Stucchio <stucchio@gmail.com>
# Nginx
RUN apt-get update && apt-get install -y nginx nginx-extras && mkdir /var/www
ADD nginx.conf /etc/nginx/nginx.conf
ADD run_nginx.sh /bin/run_nginx.sh
RUN chmod +x /bin/run_nginx.sh