Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

David Yerrington dyerrington

💭
I may be slow to respond.
Block or report user

Report or block dyerrington

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
@dyerrington
dyerrington / readme.md
Last active Jan 9, 2019
This is a very basic data generator to test recommender systems. A future version may simulate the actual sparseness of ratings data with a simple bootstrap function but for now, numpy generator does the job.
View readme.md

RecData

To use this snippet, install faker:

pip install faker
View dsi_student_install_guide.md
@dyerrington
dyerrington / environment.yml
Last active Apr 19, 2018
This assumes you've created an environment called "dsi". To use this file, simply click on "raw" then download the contents to a new file on your local system called "environment".
View environment.yml
name: dsi
channels:
- conda-forge
- defaults
dependencies:
- appnope=0.1.0=py36_0
- asn1crypto=0.22.0=py36_0
- attrs=17.2.0=py_1
- automat=0.6.0=py36_0
- backports=1.0=py36_1
@dyerrington
dyerrington / environment.yml
Created Apr 19, 2018
This assumes you've created an environment called "dsi", like this:
View environment.yml
name: dsi
channels:
- conda-forge
- defaults
dependencies:
- asn1crypto=0.22.0=py36_0
- beautifulsoup4=4.5.3=py36_0
- blas=1.1=openblas
- bleach=2.0.0=py36_0
- bokeh=0.12.9=py36_0
@dyerrington
dyerrington / environment.yml
Created Apr 19, 2018
This assumes you've created an environment called "dsi", like this:
View environment.yml
name: dsi
channels:
- conda-forge
- defaults
dependencies:
- asn1crypto=0.22.0=py36_0
- beautifulsoup4=4.5.3=py36_0
- blas=1.1=openblas
- bleach=2.0.0=py36_0
- bokeh=0.12.9=py36_0
View item-to-item.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View ttest-pvalue-widget.py
from ipywidgets import interact, interactive, fixed, interact_manual
from IPython.display import clear_output
import ipywidgets as widgets
g1_mean = widgets.IntSlider(description="G1 Mean", min=50,max=250,step=1,value=50)
g1_std = widgets.IntSlider(description="G1 STD", min=1,max=50,step=1,value=3)
g1_sample_size = widgets.IntSlider(description="G1 Size", min=50,max=500,step=10,value=10)
g1_items = [g1_mean, g1_std, g1_sample_size]
g2_mean = widgets.IntSlider(description="G2 Mean", min=50,max=250,step=1,value=60)
@dyerrington
dyerrington / eth_cheatsheet.md
Last active Jan 3, 2018
Helpful eth snippets. I will update these through my evolution of understanding about Etherium.
View eth_cheatsheet.md

Attach to console

After running geth for a while, I found that I could no longer attach to a running session. The message I encountered was Fatal: Unable to attach to remote geth: Timed out waiting for pipe '\\.\pipe\geth.ipc' to come available. I was able to resolve this by attaching to the RPC (?) endpoint.

geth attach http://127.0.0.1:8545

Check balance

Logging into the console (attach to a running session), to get current amount of Ethereum:

@dyerrington
dyerrington / auto_reload.py
Created Dec 6, 2017
This basic Python snippet is a basic pattern to automatically reload the contents of a file after it has changed. You can also adapt this example to extend the "watching" to include all files and directories within current context if you want to also trigger a reload on file modification / change.
View auto_reload.py
import os, sys
from time import sleep
## We could update this to all files in all subdirectories
watching = [__file__]
watched_mtimes = [(f, os.path.getmtime(f)) for f in watching]
while True:
print("Idle...")
sleep(2) ## So not to kill our CPU cycles
@dyerrington
dyerrington / service.py
Created Nov 18, 2017
This service.py file demonstrates a variety of possible solutions. The "boosted" solution actually loads the model in the beginning of the file but doesn't predict probabilities.
View service.py
from flask import Flask, jsonify, request
from sklearn.linear_model import LogisticRegression
## additional imports
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import AdaBoostClassifier
from sklearn.externals import joblib
from sklearn.datasets import load_iris
import numpy as np
You can’t perform that action at this time.