Skip to content

Instantly share code, notes, and snippets.

Skipper Seabold jseabold

Block or report user

Report or block jseabold

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jseabold /
Created Sep 9, 2017
Some functions for dealing with docker registry manifests
import urllib
import docker
def get_manifest_auth_token(repo):
query = urllib.parse.urlencode({
'service': '',
'scope': 'repository:{repo}:pull'.format(repo=repo)
jseabold /
Created Sep 27, 2016
Create correlated binary variables. Based on Leisch, Weingessel, and Hornik (1998).
Heavily inspired by the R package bindata.
import numpy as np
from scipy import interpolate
from scipy import stats
def corr_to_joint(corr, marginals):
jseabold /
Created Sep 27, 2015
git filter-branch magic using Python
#! /usr/bin/env python
import glob
import os
import shutil
import re
from collections import namedtuple
import subprocess
from subprocess import PIPE
jseabold /
Created Aug 11, 2015
Plot EC2 spot pricing with boto3 and pandas
import pandas as pd
from boto3 import client
client = client(service_name='ec2')
prices = client.describe_spot_price_history(InstanceTypes=["m3.medium"],
df = pd.DataFrame(prices['SpotPriceHistory'])
df.set_index("Timestamp", inplace=True)
df["SpotPrice"] = df.SpotPrice.astype(float)
jseabold /
Created Jan 28, 2015
sklearn transformers that can account for categorical variables
import numpy as np
from sklearn.base import TransformerMixin, BaseEstimator
class StandardTransformer(BaseEstimator, TransformerMixin):
def __init__(self, variables=[], ignore=[]):
self.variables = variables
self.ignore = ignore
self.transform_idx = np.asarray([True if i not in self.ignore
else False for i in self.variables])
import os
import calendar
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FixedLocator, FixedFormatter
import pandas as pd
import seaborn as sns
to_colors = lambda x : x/255.
jseabold / pymc_spatial_surival_debug.ipynb
Created Jun 25, 2014
Replicates Table 4 columns 3 and 5. Fails on Table 3 column 3 of Darmofal's "Bayesian Spatial Survival Models for Political Event Processes"
View pymc_spatial_surival_debug.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
jseabold /
Last active Jun 11, 2018
Try to replicate BUGS code with PyMC for Table 3, Column 1 of "Bayesian Spatial Survival Models for Political Event Processes."
from pymc import Gamma, Poisson, Normal, MCMC, deterministic
import numpy as np
dta = dict(T=73, Nsubj=430, eps=0.0, t=[1, 21, 85, 128, 129, 148, 178, 204,
206, 210, 211, 212, 225, 238, 241,
248, 259, 273, 275, 281, 286, 289,
301, 302, 303, 304, 313, 317, 323,
344, 345, 349, 350, 351, 355, 356,
359, 364, 385, 386, 389, 390, 391,
392, 394, 395, 396, 397, 398, 399,
jseabold / 0_reuse_code.js
Created Apr 3, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
jseabold / build.log
Created Apr 2, 2014
Failure of Cython build. `cython3 -a mwe.pyx && gcc -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/usr/include/python3.3m -I/home/skipper/.local/lib/python3.3/site-packages/numpy/core/include -o mwe.c`
View build.log
In file included from /home/skipper/.local/lib/python3.3/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0,
from /home/skipper/.local/lib/python3.3/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from /home/skipper/.local/lib/python3.3/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from mwe.c:346:
/home/skipper/.local/lib/python3.3/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \
In file included from /usr/include/python3.3m/pytime.h:6:0,
from /usr/include/python3.3m/Python.h:65,
from mwe.c:16:
You can’t perform that action at this time.