Skip to content

Instantly share code, notes, and snippets.

Feeling focused

Jay Cary Wilson jwilson8767

Feeling focused
View GitHub Profile
import boto3
def ddb_delete_all_items(table_id, partition_key, sort_key=None):
Bulk deletion of all items in a DynamoDB Table.
See also:
[boto3 doc](
jwilson8767 / rounding_utils.js
Created Apr 28, 2020
More javascript rounding options!
View rounding_utils.js
I had trouble finding simple methods for rounding modes like half-even and
half-away-from-zero in Javascript, so here's what I came up with! Enjoy!
MIT licensed
* Applies half-even rounding to the given number of significant figures. Supports n as a single value or series.
jwilson8767 /
Last active Oct 1, 2019
Python and GIS resources

Python and GIS Resources

This is an entrypoint into the world of GIS using Python. It's not everything you'll need to know, but it should help you get oriented and serve as a reference in the future.

A couple tools I recommend you setup right from the start are Conda:

  1. The Conda package manager is a quick way to get a working python environment and add bells and whistles as needed.
  2. Once you have conda, run conda install -c conda-forge jupyter pandas geopandas using your Conda Prompt to get a bunch of the packages I expect you'll need right from the start. The -c conda-forge specifies that conda should try to lookup things in the "Conda Forge" package repository, which is how many of the open source python GIS tools are distributed. Jupyter is an interactive python programming tool that makes it easy to experiment and make mistakes. Pandas and GeoPandas are covered more below.
  3. Now that you have Jupyter, you can run jupyter notebook in your Conda Prompt
jwilson8767 /
Last active Aug 18, 2019
Python wildcard apply / glob apply
# Author: jwilson8767
import collections
def glob_apply(obj, paths, fn: callable, **kwargs) -> None:
Iterates a deeply nested structure using dot-notation wildcard paths.
:param obj: The List/Sequence or Dict/Mapping to iterate
View gist:8b831142969f1468bee28e7e7399d239
def beep():
# try to use windows sound to beep
import winsound
winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS)
except ImportError:
# usually works on unix systems
jwilson8767 /
Created Feb 19, 2019
Geopandas concurrent sjoin
from concurrent.futures import as_completed, ProcessPoolExecutor
import geopandas as gpd
import pandas as pd
import numpy as np
from import Sequence
from shapely import prepared
def sjoin(left_df, right_df, op='intersects', how='inner', lsuffix='left', rsuffix='right', fail_crs_mismatch: bool = True, fail_missing_geometries: bool = False) -> gpd.GeoDataFrame:
"""Spatial join of two GeoDataFrames. GeoPandas sjoin with concurrency (split naively using df slicing).
jwilson8767 /
Last active May 14, 2020
Docker Toolbox for Windows and Windows Subsystem for Linux (aka Bash on Windows)
# This script installs and configures WSL to work with Docker Toolbox for Windows.
# 1. Install WSL (check out [bowinstaller]( for programmatic installation.
# 2. Run the contents of this script in Bash. (copy and paste works fine, no need to save)
sudo -sEH << 'EOM'
# Install the docker client and docker-compose
apt-get update && apt-get install -y curl ca-certificates
curl -sSL | sh
curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
jwilson8767 / es6-element-ready.js
Last active May 25, 2022
Wait for an element to exist. ES6, Promise, MutationObserver
View es6-element-ready.js
// MIT Licensed
// Author: jwilson8767
* Waits for an element satisfying selector to exist, then resolves promise with the element.
* Useful for resolving race conditions.
* @param selector
* @returns {Promise}