Skip to content

Instantly share code, notes, and snippets.

@kylebarron
kylebarron / parquet_metadata_exploration.py
Created February 25, 2022 20:14
Explore partitioning geometries into arrow row groups with bbox metadata info
import json
import pyarrow as pa
import pyarrow.parquet as pq
import pandas as pd
import numpy as np
def main():
# Create random point data within bbox
size = 1_000_000
@hofmannsven
hofmannsven / README.md
Created December 6, 2017 00:32
Increase key repeat rate on macOS

Increase key repeat rate on macOS

Settings: System Preferences » Keyboard » Key Repeat/Delay Until Repeat

Use the commands below to increase the key repeat rate on macOS beyond the possible settings via the user interface. The changes aren't applied until you restart your computer.

Source: https://apple.stackexchange.com/a/83923

@lukasmartinelli
lukasmartinelli / tolerance_per_zoom.md
Last active September 27, 2022 00:40
ST_Simplify tolerance per zoom level
zoom_level tolerance
      0 |  78271.516953125
      1 | 39135.7584765625
      2 | 19567.8792382812
      3 | 9783.93961914062
      4 | 4891.96980957031
      5 | 2445.98490478516
      6 | 1222.99245239258

7 | 611.496226196289

@perrygeo
perrygeo / rgba-to-masked.py
Last active August 8, 2018 03:05
Convert RGBA to RGB with GeoTIFF mask
import rasterio
import click
@click.command()
@click.argument("rgba_path")
@click.argument("out_path")
@click.option("--internal-mask/--external-mask", default=True)
@click.option("--ycbcr", default=False, is_flag=True)
@click.option("--use-blocks/--no-use-blocks", default=True)

Minimum Viable Async with Node 6

With the release of Node 6.0.0, the surface of code that needs transpilation to use ES6 features has been reduced very dramatically.

This is what my current workflow looks like to set up a minimalistic and fast microservice using micro and async + await.

The promise

@sconnelley
sconnelley / mapreduce.py
Last active August 29, 2015 14:04
Python parser for maps.stamen.com log files
# Parses maps.stamen.com log files
# 99% of the code comes from http://pymotw.com/2/multiprocessing/mapreduce.html
# Another useful article can be found here, http://effbot.org/zone/wide-finder.htm
# Per file processing time could be improved with threads I imagine
# roughly 2k-3k files totaling ~ 150mb takes about 30min
"""
Usage:
1. Download log files from s3 into local dated directories with your weapon of choice.
@andyshinn
andyshinn / DEISAWS.md
Last active April 5, 2017 04:22
Deis AWS Deployment

Deploying Deis on AWS

These instructions will get you up and running with Deis and CoreOS in a AWS VPC. There already exists a CloudFormation script to get up and running in AWS. But if you want to get down and dirty, this document will help walk you through the steps.

I tried to build these instructions for both the AWS web console and equivilent AWS CLI. If you find errors, please feel free to comment so I can update them. You can also find me in the #deis IRC channel on Freenode if you have questions.

AWS

Since we will be running CoreOS and Deis inside a VPC we need some AWS setup first. We need a single subnet VPC, some security groups, and instances of CoreOS.

@juliangruber
juliangruber / README.md
Last active March 24, 2021 02:00
lightweight node-websocketd

node-websocketd

A lightweight node port of websocketd, originally written in go.

Usage

node-websocketd --port=8080 ./count.sh
var perlin = require('perlin').noise.perlin3
var fill = require('ndarray-fill')
var zeros = require('zeros')
var scale = 0.075
var threshold = 0.125
// Untested in 3D, but "theoretically" this should
// work. Using the equivalent 2d getter with the
// continuous-box2d demo works well.
@migurski
migurski / deimgify.py
Last active December 17, 2015 13:29
Store sparse bundle disk images as a series of 24 bit losslessly-encoded PNG images. Let Flickr’s 1TB of storage hold them for you.
#!/usr/bin/env python
''' Convert a series of PNG images to a sparse bundle disk image.
Image file names are passed in as command line arguments.
Example:
ls *.png | xargs deimgify.py
Output:
Goodtimes.sparsebundle/Info.bckup