Skip to content

Instantly share code, notes, and snippets.

@lossyrob
lossyrob / geojson-polygon-fill-color.json
Created December 8, 2015 22:01
GeoJson Polygons with fill colors
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lossyrob
lossyrob / 2021-09-foss4g-ai4e-talks.md
Last active September 29, 2021 16:37
FOSS4G 2021 Microsoft AI for Earth track talk schedule
@lossyrob
lossyrob / azure-batch-force-pull.md
Last active August 20, 2021 16:40
Forcing an Azure Batch node to pull from ACR without restarting the node

Forcing an Azure Batch node to pull from ACR

Sometimes you want to keep a node in an Azure Batch pool up and running as you're debugging tasks so that you don't have to pay the waiting time to spin up and down a node. You may want to push a new image to ACR with the same tag to run the job based on fixes based on the last run. However, Azure Batch nodes don't pull an updated image by default, and will run with the same image if a task is run again even if ACR has been updated.

The best solution I've found to speed things up is:

  • In Batch Explorer, go to the pool view, right click on the node, and "connect"
  • This will ssh into the node. Inside of the shell, run:
@lossyrob
lossyrob / markdown-details-collapsible.md
Created June 17, 2021 15:00 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@lossyrob
lossyrob / mixing-overloads-default-params.md
Last active April 14, 2021 23:26
Mixing overloads and default parameters in Scala

Mixing overloads and default parameters in Scala

The problem

There are some situations that arise where you want default arguments in object apply methods, but you also want to overload the apply. For instance, in GeoTrellis, we have an S3LayerWriter which allows you to write an RDD of rasters out of Amazon's S3 storage backend. In order to operate, it needs an AttributeStore, which is the type responsible for reading and writing metadata. A simplified (not real) signature of the attribute store looks like

case class AttributeStore(bucket: String, prefix: String)
@lossyrob
lossyrob / cb-watershed.geojson
Last active February 19, 2021 22:48
Chesapeake Bay Watershed
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lossyrob
lossyrob / split_geom.py
Last active December 11, 2020 00:44
Fishnet split of geometry via shapely
import os, sys
import argparse
from shapely.geometry import shape, mapping, box
import json
def split_geom(geometry, output_dir, base_name, cols, rows):
bounds = geometry.bounds
xmin = bounds[0]
xmax = bounds[2]
ymin = bounds[1]
@lossyrob
lossyrob / ingest-geotiff.sh
Last active November 1, 2020 12:41
Ingest GeoTIFF into HDFS using GeoTrellis spark (0.10 Snapshot)
### INGEST GEOTIFFS INTO HDFS ###
# geotrellis-spark JAR. Shouldn't have to change this one if running in the root folder (remember to run ./sbt "project spark" assembly)
JAR=spark/target/scala-2.10/geotrellis-spark-assembly-0.10.0-SNAPSHOT.jar
# Amount of memory for the driver
DRIVER_MEMORY=3G
# Amount of memory per executor. If in local mode, change the DRIVER_MEMORY instead.
EXECUTOR_MEMORY=512G
@lossyrob
lossyrob / continental-usa.geojson
Last active August 21, 2020 09:47
Rough continental USA single polygon GeoJSON
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lossyrob
lossyrob / hcris-diff-matches-1.json
Created April 6, 2020 17:02
HCRIS different matches
{
"type": "Feature",
"properties": {
"ID": "4937061",
"OBJECTID": "3503",
"Provider Number": "440232",
"X": -87.689643485999966,
"Y": 36.320170566000058,
"NAME": "HOUSTON COUNTY COMMUNITY HOSPITAL",
"ADDRESS": "5001 E. MAIN STREET",