Skip to content

Instantly share code, notes, and snippets.

View duhaime's full-sized avatar

Douglas Duhaime duhaime

View GitHub Profile
@duhaime
duhaime / gh-pages-deploy.md
Created June 18, 2018 22:51 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@duhaime
duhaime / gist:a2176ac71215c080b243d6c87df5739c
Created June 27, 2018 14:34 — forked from sebsto/gist:19b99f1fa1f32cae5d00
Install Maven with Yum on Amazon Linux
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
@duhaime
duhaime / .block
Created September 11, 2018 10:37 — forked from Fil/.block
visualizing map distortion d3v4
license: mit
@duhaime
duhaime / .block
Created September 11, 2018 10:40 — forked from mbostock/.block
Milky Way
license: gpl-3.0
@duhaime
duhaime / README.md
Created October 1, 2018 01:09 — forked from armollica/README.md
K-D Tree Nearest Neighbors (k-NN)

k-d tree nearest neighbors search (k-NN). The red dots are the 10 nearest neighbors. Orange dots are scanned and not selected.

Compare with this block that implements a k nearest neighbor search using a quadtree instead of a k-d tree.

The algorithm for this search came from this course handout. Note that the "k" in k-d tree need not be the same number as the "k" in

@duhaime
duhaime / README.md
Created October 1, 2018 01:12 — forked from armollica/README.md
K-Nearest Neighbors

K-nearest neighbors search of a 2D set of points. Move the slider or scroll to change k.

The algorithm was adapted from this block

@duhaime
duhaime / index.html
Last active October 26, 2018 14:05 — forked from omimo/index.html
Dancing Lines
<html>
<head>
<title>
[Visualizing Movement Data with D3.js]
</title>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://omid.al/Mova-Viz/MovaViz-v0.1.2.js"></script>
<style>
* {
box-sizing: border-box
@duhaime
duhaime / .block
Created April 3, 2019 00:15 — forked from Fil/.block
Circular Vortex Emergence
license: gpl-3.0
border: no
scrolling: no
height: 500
@duhaime
duhaime / bezier_curves.py
Created April 30, 2019 09:58 — forked from astrojuanlu/bezier_curves.py
Interactive Bézier curves with Python using just matplotlib.
import matplotlib
matplotlib.use('webagg')
import numpy as np
from scipy.special import binom
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
@duhaime
duhaime / separate_points.py
Created January 2, 2020 17:37 — forked from naught101/separate_points.py
Separating points on a map
def lat_lon_hex_mesh(bounds, d=3):
"""Creates a hexagonal lat/lon mesh within bounds that has a radial separation of d"""
lone, lonw, lats, latn = bounds
# heigt of equilatral triangle from radial distance sqrt(r^2 - (r/2)^2)
h = np.sqrt(0.75) * d
w = d / 2
lat_vals = np.arange(lats, latn, h)