Skip to content

Instantly share code, notes, and snippets.

from datetime import datetime
from enum import Enum
from dateutil.relativedelta import relativedelta
from typing import Tuple, List
def get_today() -> datetime:
tz = pytz.timezone('America/New_York')
return datetime.now(tz)
@brendancol
brendancol / paint-colors.json
Last active March 7, 2020 01:58
Common Paint Color Hex Values (scraped from https://www.matchmypaintcolor.com)
{"abbey-white": "#EBE5D0", "abyss": "#DFE6EA", "acapulco-cliffs": "#4E9AA8", "acceleration": "#808EA1", "accolade": "#F1EEE2", "acorn-squash": "#FFDF38", "admiralty": "#404E61", "adobe-white": "#F2ECD9", "adorable": "#E3BEB0", "adventure": "#34788C", "after-the-storm": "#919FA1", "afternoon-tea": "#594E40", "ageless": "#ECECDF", "airy": "#DAE6E9", "alaskan-blue": "#7E9EC2", "alaskan-mist": "#ECF0E5", "aldabra": "#AAA492", "all-about-olive": "#676C58", "allegro": "#B28959", "alley-cat": "#656874", "allspice": "#CC974D", "almond-brittle": "#B5865A", "almond-cream": "#E1CFB2", "almond-paste": "#E5DBC5", "almond-roca": "#B89068", "almost-aloe": "#BFE5B1", "almost-aqua": "#98DDC5", "aloe-essence": "#ECF1E2", "aloe-vera": "#DBE5B9", "aloha": "#1DB394", "aloof": "#D4E2E6", "alpaca-wool": "#E4D5BC", "alpine-blue": "#DBE4E5", "always-almond": "#EBE5D2", "always-apple": "#A0A667", "always-blue": "#A2BACB", "alyssa": "#F4E2D6", "amaretto": "#AB6F60", "amaretto-sours": "#C09856", "ambrosia": "#F4DED3", "american-anthem":
@brendancol
brendancol / rgb_bigtiff_cogs_notes.md
Created March 5, 2020 07:40 — forked from palmerj/rgb_bigtiff_cogs_notes.md
Creating BigTiff COGS for raster RGB photos from a tile mosaic directory using GDAL

Creating a Cloud Optimised Geotiffs (COGs) for raster photo imagery

This process outlines the process for creating Cloud Optimised Geotiffs suitable for hosting in services such as AWS S3. COGs enables more efficient workflows use cases such as fast access from Functions as a Services (E.g AWS Lambda), or comsumption into client desktop GIS systems (e.g QGIS). For more details on COGs please see https://www.cogeo.org/in-depth.html

1. Create a mosaic

@brendancol
brendancol / abort-example.js
Created June 29, 2018 15:12
Abort Controller Polyfill Example
import React, { Component } from 'react';
import './Fetch.css';
import 'abortcontroller-polyfill/dist/polyfill-patch-fetch';
const AbortController = window.AbortController;
const controller = new AbortController();
const signal = controller.signal;
class Fetch extends Component {
@brendancol
brendancol / rolling_window.py
Created May 19, 2017 09:23 — forked from seberg/rolling_window.py
Multidimensional rolling_window for numpy
def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True):
"""Create a view of `array` which for every point gives the n-dimensional
neighbourhood of size window. New dimensions are added at the end of
`array` or after the corresponding original dimension.
Parameters
----------
array : array_like
Array to which the rolling window is applied.
window : int or tuple
@brendancol
brendancol / environment.yml
Created May 8, 2017 09:16
Conda Environment for the GeoPython Point Cloud Talk (Tested on OSX)
name: point-clouds
channels:
- menpo
- conda-forge
- defaults
dependencies:
- libiconv=1.14=4
- libxslt=1.1.29=3
- pyside=1.2.4=py27_6
- configobj=5.0.6=py27_0
@brendancol
brendancol / dkdtree.py
Last active November 9, 2018 16:42
Distributed KDTree using Dask
from functools import partial
import numpy as np
from scipy.spatial import cKDTree
from dask.delayed import delayed
import dask.bag as db
class DaskKDTree(object):
"""
Usage Example:
@brendancol
brendancol / names.py
Created February 13, 2017 05:47
Ethnicity from baby names NYC
from sklearn.ensemble import RandomForestClassifier
from sklearn import preprocessing
import pandas as pd
import numpy as np
from functools import partial
def encode_data(df, cols):
@brendancol
brendancol / py
Created February 13, 2017 05:47
Ethnicity from baby names NYC
from sklearn.ensemble import RandomForestClassifier
from sklearn import preprocessing
import pandas as pd
import numpy as np
from functools import partial
def encode_data(df, cols):
@brendancol
brendancol / hdf_to_parquet.py
Created November 10, 2016 17:17
HDF5 Census -> Parquet
# Install fastparquet and pytables
# conda install pytables
# conda install -c conda-forge fastparquet
# conda install python-snappy
import pandas as pd
import fastparquet as fp
# Write file
df = pd.read_hdf(data_path, base)