Skip to content

Instantly share code, notes, and snippets.

@ericdill
ericdill / cmap
Created May 11, 2017 01:18
6 element viridis colormap
# import matplotlib.cm as cm
# import numpy as np
# np.round(cm.viridis(np.arange(0, 1.2, 1/5)) * 255)
array([[ 68, 1, 84, 255],
[ 65, 68, 135, 255],
[ 42, 120, 142, 255],
[ 34, 168, 132, 255],
[122, 209, 81, 255],
[253, 231, 37, 255]])
@ericdill
ericdill / pre-commit
Last active July 21, 2018 04:18
Pre-commit hook that reformats your code according to yapf
#!/bin/bash
# capture the changed files that have been staged
changed_files=$(git diff --staged --name-only)
echo "Changed files: ${changed_files}"
for file in ${changed_files}
do
echo "Modifying ${file}"
yapf ${file} -i
git add ${file}
done
@ericdill
ericdill / render_env.py
Last active October 20, 2021 20:22
Render the dependency graph for your conda environment (needs graphviz!)
import json
import glob
import os
from os.path import join, basename
# install this with "conda install -c conda-forge python-graphviz"
import graphviz as gv
# path to your conda environment
path = os.environ.get('CONDA_PREFIX')
if path is None:
@ericdill
ericdill / gist:1ca448a1d4d923c5cfdd35791359f99d
Created September 16, 2016 20:10
pydata carolinas 2016
Jonathan Helmus's Talk: https://docs.google.com/presentation/d/18d5uGYUc7ZVrgABmz8wH4XdD8B8nAhCzRYwienPtZFE/edit#slide=id.p
#!/bin/bash
CONDA_DOWNLOAD_LOCATION=$BUILD_DIR/miniconda.sh
CONDA_INSTALL_LOCATION=$BUILD_DIR/miniconda
if [ ! -f $CONDA_DOWNLOAD_LOCATION ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $CONDA_DOWNLOAD_LOCATION
fi
bash $CONDA_DOWNLOAD_LOCATION -b -p $CONDA_INSTALL_LOCATION
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
name: erics_env
dependencies:
- numpy
- matplotlib
- scikit-image
$ conda build usaddress/
Removing old build environment
BUILD START: usaddress-0.5.7-py35_0
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata .............
WARNING: conda-build appears to be out of date. You have version 1.21.4 but the
latest version is 1.21.5. Run
conda update -n root conda-build
$ apm list
Built-in Atom Packages (89)
├── about@1.5.0
├── archive-view@0.61.1
├── atom-dark-syntax@0.27.0
├── atom-dark-ui@0.51.0
├── atom-light-syntax@0.28.0
├── atom-light-ui@0.43.0
├── autocomplete-atom-api@0.10.0
├── autocomplete-css@0.11.1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.