Skip to content

Instantly share code, notes, and snippets.


Daniel J. H. daniel-j-h

View GitHub Profile
daniel-j-h / Map.kt
Last active Jun 18, 2022
Adapting an imperative map (Google Map, Mapbox Map, etc.) for a declarative UI such as Android Compose; below shows an example for a Mapbox map, in you will find an example for a Google Map
View Map.kt
package com.example.view
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.viewinterop.AndroidView
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import com.mapbox.geojson.Point
daniel-j-h / input-gdalinfo.txt
Created Sep 3, 2020
rasterio `rio convert` ground control point issue
View input-gdalinfo.txt
Driver: GTiff/GeoTIFF
Files: grd-vv-native.tif
Size is 26569, 16673
GCP Projection =
DATUM["World Geodetic System 1984",
View Dockerfile
FROM ubuntu:20.04
ENV LANG="C.UTF-8" LC_ALL="C.UTF-8" PATH="/home/python/.poetry/bin:/home/python/.local/bin:$PATH" PIP_NO_CACHE_DIR="false"
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3 python3-pip python-is-python3 curl ca-certificates && \
rm -rf /var/lib/apt/lists/*
RUN groupadd --gid 1000 python && \
useradd --uid 1000 --gid python --shell /bin/bash --create-home python
daniel-j-h /
Created Mar 19, 2019
Conflict-free replicated data type (CRDT) counters - strong eventual consistency in a distributed system
import random
class GrowCounter:
'''Convergent conflict-free replicated data type state based grow-only counter.
Guarantees strong eventual consistency.
def __init__(self, n):
assert n > 0, 'at least one node in cluster'
daniel-j-h /
Last active Jul 10, 2018
Test-time augmentation utility helper for
#!/usr/bin/env python3
pip install tqdm pillow mercantile
Simple image rotation script for test-time augmentation.
daniel-j-h /
Last active Feb 3, 2022
Tiles GeoTIFF for zoom level
#!/usr/bin/env python3
pip install tqdm numpy pillow mercantile 'rasterio==1.0b1' 'rio-tiler==1.0a7'
import os
import argparse
View initial-turn-restrictions.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
daniel-j-h /
Created Jan 5, 2018
Builds architecture optimized TensorFlow from source, for
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
# Usage: ./ broadwell /tmp/wheel
# Builds TensorFlow 1.4.0 from source for a specific architecture.
# Assumes Ubuntu 16.04, installs dependencies and the bazel buildsystem.
daniel-j-h /
Last active May 1, 2017
BK-Tree for nearest neighbor queries in metric spaces
#include <climits>
#include <cstdint>
#include <cstdlib>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
daniel-j-h /
Created Mar 5, 2017
q-gram inverted lists index for fuzzy autocompletion - works surprisingly well already
#!/usr/bin/env python3
import sys
import argparse
import collections
import curses
import curses.textpad
#python3 -m venv --system-site-packages venv