Skip to content

Instantly share code, notes, and snippets.

View lx-88's full-sized avatar

Michael Ewald lx-88

  • Northwest USA
View GitHub Profile
@drewda
drewda / gist:1299198
Created October 19, 2011 18:23
Jenks natural breaks classification
# code from http://danieljlewis.org/files/2010/06/Jenks.pdf
# described at http://danieljlewis.org/2010/06/07/jenks-natural-breaks-algorithm-in-python/
def getJenksBreaks( dataList, numClass ):
dataList.sort()
mat1 = []
for i in range(0,len(dataList)+1):
temp = []
for j in range(0,numClass+1):
temp.append(0)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 14, 2025 16:53
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dmeliza
dmeliza / scalebars.py
Last active February 7, 2023 00:33
matplotlib: add scale bars to axes
# -*- coding: utf-8 -*-
# -*- mode: python -*-
# Adapted from mpl_toolkits.axes_grid1
# LICENSE: Python Software Foundation (http://docs.python.org/license.html)
from matplotlib.offsetbox import AnchoredOffsetbox
class AnchoredScaleBar(AnchoredOffsetbox):
def __init__(self, transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4,
pad=0.1, borderpad=0.1, sep=2, prop=None, barcolor="black", barwidth=None,
**kwargs):
@szs8
szs8 / pandasgrid.py
Created September 7, 2012 21:12
Display a pandas dataframe in a wx grid
#!/usr/bin/env python
import wx
from wx import EVT_CLOSE
import wx.grid as gridlib
EVEN_ROW_COLOUR = '#CCE6FF'
GRID_LINE_COLOUR = '#ccc'
class PandasTable(wx.Frame):
@troyhill
troyhill / HL_function.R
Last active December 16, 2015 19:59
R function to pick out high and low tides from a dataset of tidal water levels
### Important note: I'm no longer maintaining this gist, since this code is incorporated into the
### VulnToolkit package.
### Because it's not being maintained, the code below might not work. The latest, updated version
### is available at https://github.com/troyhill/VulnToolkit/blob/master/R/HL.r
### Function to pick out high and low tides from a dataset of tidal water levels
###
### Arguments:
@JesseBuesking
JesseBuesking / logging.yaml
Created April 14, 2014 18:54
Testing MultiProcessingLog on both Windows 7 Enterprise and Ubuntu Developers Version 10.04_20121120.
---
version: 1
disable_existing_loggers: False
formatters:
simple:
format: "%(name)-20s%(levelname)-8s%(message)s"
handlers:
console:
class: logging.StreamHandler
level: DEBUG
@jwass
jwass / delaunay.py
Last active February 27, 2019 13:42
Example using proposed Delaunay triangulation method in Shapely
import matplotlib.pyplot as plt
import numpy as np
from shapely.geometry import LineString
from shapely.ops import triangulate
def uniform_sample(poly, n=100):
"""
Uniformly sample the Delaunay triangulation of a polygon. If the polygon
is convex, this will uniformly sample its area.
@YKCzoli
YKCzoli / Lidar_walkthrough.md
Last active November 15, 2023 18:35
Lidar_walkthrough

Processing LiDAR to extract building heights

Walk through

Detailed walk through of building extraction using postgis

First lets pull a data layer from of openstreetmap. You can do this any which way you’d like, as there are a variety of methods for pulling openstreetmap data from their database. Check the [wiki] (http://wiki.openstreetmap.org/wiki/Downloading_data) for a comprehensive list. My favourite method thus far is pulling the data straight into QGIS using the open layers plugin. For those who may want to explore this method, check [this tutorial] (http://www.qgistutorials.com/en/docs/downloading_osm_data.html). For building extraction you only need building footprints, and include the building tags. Not all polygons are of type building in OSM, so we can download all the polygons, and then filter the layer for only polygons tagged as buildings.

LiDAR data was pulled from USGS via the Earth Explorer site. [Here] (http://earthobservatory.nasa.gov/blogs/ele

@clhenrick
clhenrick / README.md
Last active March 3, 2025 23:02
PostgreSQL & PostGIS cheatsheet (a work in progress)
@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active March 11, 2025 21:24
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose