Skip to content

Instantly share code, notes, and snippets.

View draperjames's full-sized avatar

James Draper draperjames

View GitHub Profile
/home/james/.pyenv/versions/3.8.5/envs/main_dev/lib/python3.8/site-packages/sklearn/model_selection/_validation.py:548: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details:
Traceback (most recent call last):
File "/home/james/.pyenv/versions/3.8.5/envs/main_dev/lib/python3.8/site-packages/sklearn/model_selection/_validation.py", line 531, in _fit_and_score
estimator.fit(X_train, y_train, **fit_params)
File "/home/james/.pyenv/versions/3.8.5/envs/main_dev/lib/python3.8/site-packages/sklearn/ensemble/_forest.py", line 386, in fit
trees = Parallel(n_jobs=self.n_jobs, verbose=self.verbose,
File "/home/james/.pyenv/versions/3.8.5/envs/main_dev/lib/python3.8/site-packages/joblib/parallel.py", line 1042, in __call__
self.retrieve()
File "/home/james/.pyenv/versions/3.8.5/envs/main_dev/lib/python3.8/site-packages/joblib/parallel.py", line 921, in retrieve
self._output.extend(job.get(timeout=self.timeout))
@draperjames
draperjames / ..git-pr.md
Created June 1, 2018 17:39 — forked from gnarf/..git-pr.md
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@draperjames
draperjames / pr.md
Created June 1, 2018 17:22 — forked from kennethreitz/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@draperjames
draperjames / show_pip_pkg
Created May 24, 2018 20:58
Show pip specific package on windows
pip freeze | findstr <package name>
@draperjames
draperjames / jlab_setup_miniconda3.cmd
Last active June 21, 2018 20:53
Jupyter Lab setup for Windows 10
conda update conda -y
python -m pip install --update pip
conda install cython -y
conda install pandas -y
conda install statsmodels -y
@draperjames
draperjames / miniconda_installer.cmd
Last active May 23, 2018 15:12
Miniconda3 Install Windows 10
:: Miniconda3 Installer for Windows 10
:: Author: James Draper
:: Date: 5/23/2018
:: NOTE: Run this script from administrator prompt.
cd %userprofile%\Downloads
mkdir tmp
cd tmp
@draperjames
draperjames / unix_miniconda3_quick_install.sh
Last active June 7, 2018 15:28
Unix Miniconda3 Quick Install
mkdir tmp && cd tmp
wget http://repo.continuum.io/miniconda/Miniconda3-3.7.0-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p ~/miniconda
# export PATH="$HOME/miniconda/bin:$PATH"
@draperjames
draperjames / export_repo_issues_to_csv.py
Created May 15, 2018 20:14 — forked from unbracketed/export_repo_issues_to_csv.py
Export Issues from Github repo to CSV (API v3)
"""
Exports Issues from a specified repository to a CSV file
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to. Supports Github API v3.
"""
import csv
import requests
@draperjames
draperjames / index.html
Created March 21, 2018 01:38 — forked from jdarling/index.html
Reuseable D3 MindMap (left/right tree)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
<style type="text/css">
.node circle {
cursor: pointer;
fill: #fff;
stroke: steelblue;
@draperjames
draperjames / __repr__wrapper.py
Created March 9, 2018 01:10
A wrapper for __repr__s
def __repr__wrapper(self):
"""Show all attributes."""
return "Attributes: "+", ".join(list(self.__dict__.keys()))
def __repr__dec(func):
"""Replaces the __repr__ function of a class with __repr__wrapper"""
def call(*args, **kwargs):
func.__repr__ = __repr__wrapper
result = func(*args, **kwargs)
return result