Skip to content

Instantly share code, notes, and snippets.

View discdiver's full-sized avatar

Jeff Hale discdiver

View GitHub Profile
@discdiver
discdiver / category_encoders_example.py
Created September 2, 2018 02:05
An example of using Category Encoders.
# import the packages
import numpy as np
import pandas as pd
import category_encoders as ce
# make some data
df = pd.DataFrame({
'color':["a", "b", "a", "c"],
'outcome':[1, 2, 3, 2]})
@discdiver
discdiver / fastai_speed_test.ipynb
Created October 27, 2018 03:50
Cats vs Dogs image classification fastai v1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@discdiver
discdiver / setup.py
Created February 21, 2019 22:47
Example setup.py file for guide to creating python package
from setuptools import setup, find_packages
with open("README.md", "r") as readme_file:
readme = readme_file.read()
requirements = ["ipython>=6", "nbformat>=4", "nbconvert>=5", "requests>=2"]
setup(
name="notebookc",
version="0.0.1",
@discdiver
discdiver / notebookc.py
Created February 21, 2019 22:50
Example primary file from Python packaging guide
def convert(my_name):
"""
Print a line about converting a notebook.
Args:
my_name (str): person's name
Returns:
None
"""
print(f"I'll convert a notebook for you some day, {my_name}.")
@discdiver
discdiver / test_notebookc.py
Last active March 6, 2019 16:19
First section of test file for Medium article on adding tests to package.
"""Tests for `notebookc` package."""
import pytest
from notebookc import notebookc
def test_convert(capsys):
"""Correct my_name argument prints"""
notebookc.convert("Jill")
captured = capsys.readouterr()
assert "Jall" in captured.out
@discdiver
discdiver / bootstrap_starter_without_js.html
Created March 31, 2019 21:34
A starter template from Bootstrap without JavaScript
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
@discdiver
discdiver / k8s_deployment_with_service.yaml
Last active April 5, 2019 21:29
Specification for a Kubernetes Deployment and Service
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
apiVersion: apps/v1 # Deployments get an "apps/v1" - no longer in beta.
kind: Deployment # kind is for the type of resource.
metadata: # metadata provides information about the resource.
name: my-deployment # We name our Deployment my-deployment.
#This is the value at metadata.name.
spec:
replicas: 3 # Specify we want 3 Pods in our ReplicaSet.
selector:
matchLabels: # spec.selector.matchLabels tells the Deployment
app: my-app # to match Pods with a key - value label pair