Skip to content

Instantly share code, notes, and snippets.

View JayKickliter's full-sized avatar
💭
Cache Rules Everything Around Me

Jay Kickliter JayKickliter

💭
Cache Rules Everything Around Me
View GitHub Profile
@JayKickliter
JayKickliter / worldcover.rs
Created April 2, 2024 22:36
ESA worldcover (land-type) typedefs
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[repr(u8)]
pub(crate) enum WorldCover {
Tree = 10,
Shrub = 20,
Grass = 30,
Crop = 40,
Built = 50,
Bare = 60,
Frozen = 70,
@JayKickliter
JayKickliter / coord_or_hex.rs
Created February 23, 2024 17:55
Parsing coordinate or h3 hex from cli in rust
use h3o::LatLng;
use h3o::Resolution;
use hextree::Cell;
use std::str::FromStr;
#[derive(Debug, Clone, Copy)]
pub struct CoordOrHex(Cell);
impl FromStr for CoordOrHex {
type Err = anyhow::Error;
@JayKickliter
JayKickliter / parse_range.rs
Created February 19, 2024 17:19
Parsing a range of values in rust, suitable for command line clap parsing
// https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7d2fd8dc461ab1fc7216eb4e68c4517d
use std::str::FromStr;
#[derive(Clone, Debug, Eq, PartialEq)]
pub(crate) enum ResOpt {
Fixed(u8),
Range(u8, u8),
}
@JayKickliter
JayKickliter / download.sh
Last active January 15, 2024 01:42
Download all ESA WorldCover tiles
#!/bin/bash
set -ex
for lat in "S90" "S30" "N30"; do
for lon in "E000" "E060" "E120" "W060" "W120" "W180"; do
file_name=ESA_WorldCover_10m_2021_v200_60deg_macrotile_$lat$lon.zip
wget https://worldcover2021.esa.int/data/archive/$file_name
unzip $file_name
rm $file_name
@JayKickliter
JayKickliter / main.rs
Created January 14, 2024 23:40
ESRI Land Cover + GeoTIFF + Rust + GDAL + Projection
use anyhow::Result as AnyRes;
use gdal::{
spatial_ref::{CoordTransform, SpatialRef},
Dataset, GeoTransformEx,
};
fn main() -> AnyRes<()> {
let ds = Dataset::open("lulc2022/17R_20220101-20230101.tif")?;
// WGS84
@JayKickliter
JayKickliter / README.md
Created October 24, 2023 22:31
Rust with Address Sanitizer on M1 macOS

Usage:

$ ASAN_OPTIONS="detect_leaks=1:halt_on_error=0"  RUSTFLAGS="-Z sanitizer=address" cargo +nightly run -Z build-std=core,alloc --target aarch64-apple-darwin

Output:

    Finished dev [unoptimized + debuginfo] target(s) in 0.07s
@JayKickliter
JayKickliter / brew-deps.md
Last active August 20, 2022 17:17
Building GNU Radio 3.10 on macOS 12
/opt/homebrew/bin/pip3 install packaging mako PyYAML
/Users/jay/forks/gr-lora/build (master *=) $ brew list
==> Formulae
abseil				fftw				hicolor-icon-theme		libtasn1			numpy				readline
adwaita-icon-theme		flac				hiredis				libtiff				oniguruma			ripgrep
aften				fmt				hub				libtool				open-mpi			scipy

Keybase proof

I hereby claim:

  • I am jaykickliter on github.
  • I am kickliter (https://keybase.io/kickliter) on keybase.
  • I have a public key ASAl309uF6BvENIx7WlC40Ywqh9Ot-ZsvU_LN9edh8yDwAo

To claim this, I am signing this object:

@JayKickliter
JayKickliter / steps.md
Last active June 9, 2022 16:36
Debugging enif_protobuf segfault

Steps

# The following three lines are from the erl wrapper, 
# which is usually called instead of erlexec itself
export ROOTDIR="/home/jay/.local/OTP-23.3.4.8-debug/lib/erlang"
export BINDIR=$ROOTDIR/erts-11.2.2.7/bin
export EMU=beam

cgdb ~/.local/OTP-23.3.4.8-debug/lib/erlang/erts-11.2.2.7/bin/erlexec