Skip to content

Instantly share code, notes, and snippets.

Create presentations with jupyter notebook

Convert notebook to presentation:

jupyter nbconvert slideshow.ipynb --to slides --post serve

Useful Git commands

The laziest way to delete all unused branches safely except master:

git checkout master
git branch | xargs git branch -d

Merge master into current feature branch:

@AlexandraKapp
AlexandraKapp / osrm_docker_windows.md
Last active September 9, 2025 07:10
How to set up your own OSRM backend with Docker on Windows

How to set up your own OSRM backend with Docker on Windows

The OSRM docker quick start provides a great explanation on how to set up the container: https://hub.docker.com/r/osrm/osrm-backend/

Yet - for Docker on Windows minor changes were necessary for me (otherwise I'd get "File not found" or "Permission" errors).

This is how it worked for me:

1. Pull the image

library(sf)
xmin <- -2.3743
xmax <- 0.5589
ymin <- 37.3397
ymax <- 40.8679
st_polygon(list(rbind(
c(xmin, ymin),
c(xmin, ymax),

Setting up the conda env for a python project with jupyter lab

1. Setup new python project

1. create new environment

conda create --name myenv

with specific python version:

import numpy as np
import geopandas as gpd
import cv2
# read in data
example = gpd.read_file("data/example.gpkg")
scenario1 = gpd.read_file("data/example_similar.gpkg")
scenario2 = gpd.read_file("data/example_different.gpkg")
def signature_opt1(gdf, crs):
from haversine import haversine, Unit
# construct the cost matrix
def get_cost_matrix(gdf1, gdf2):
gdf1_centroids = gdf1.to_crs(3395).centroid.to_crs(4326)
gdf2_centroids = gdf2.to_crs(3395).centroid.to_crs(4326)
coords_sig1 = list(zip(gdf1_centroids.y, gdf1_centroids.x))
coords_sig2 = list(zip(gdf2_centroids.y, gdf2_centroids.x))
#get all potential combinations between all points from sig1 and sig2

Freeze env for documentation and sharing:

pip list --format=freeze &gt; requirements.txt