Skip to content

Instantly share code, notes, and snippets.

View erick-otenyo's full-sized avatar
🧭
Focusing

Erick Otenyo erick-otenyo

🧭
Focusing
View GitHub Profile
@erick-otenyo
erick-otenyo / raster-pixels-to-polygons.go
Last active March 30, 2022 10:14
Convert a raster layer to a vector layer, by creating geojson polygon features for each individual pixel's extent in the raster layer. Equivalent to QGIS' Raster pixels to polygons Algorithm
package main
import (
"errors"
"flag"
"math"
"os"
"github.com/lukeroth/gdal"
geojson "github.com/paulmach/go.geojson"
@erick-otenyo
erick-otenyo / .docker-private-registry-with-read-write-control.md
Created April 18, 2021 09:58
Run docker private registry with read/write access control
@erick-otenyo
erick-otenyo / django_import_shp_zip_to_postgres.py
Last active January 31, 2021 10:12
Import a zipped shapefile to a new postgis table
import pygeoif
import shapefile
from django.db import connection, transaction
from zipfile import ZipFile
from io import BytesIO
def shp_files_sorter(file_name):
"""
:param file_name:
@erick-otenyo
erick-otenyo / parse_dotenv.bash
Created January 28, 2021 09:16 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@erick-otenyo
erick-otenyo / README.md
Created December 7, 2020 18:22 — forked from mau21mau/README.md
Configure Celery + Supervisor With Django
@erick-otenyo
erick-otenyo / rsync_backup.py
Created November 4, 2020 13:15 — forked from seebk/rsync_backup.py
Python rsync backup script
#!/usr/bin/python3
#######################################################
# Python rsync Backup script
# Sebastian Kraft, 24.06.2013
#
#######################################################
#-----------------------------------------------------
# Config
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@erick-otenyo
erick-otenyo / geonode_to_terriajs.js
Last active October 2, 2019 11:30
Fetch geonode layers from api and format for Terra JS
const geonode2Terriajs = async (geonodeUrl,geonodeGeoserverUrl,proxyUrl)=> {
const catalog = []
try{
// fetch layers from geonode api, using proxy if provided
const layers = await fetch(proxyUrl?`${proxyUrl}/${geonodeUrl}`:geonodeUrl).then(res=>res.json()).then(layers=>layers.objects)
// group the layers by category
const layersByCategory = layers.reduce((all,layer)=>{
@erick-otenyo
erick-otenyo / pip-install-gdal.md
Created June 19, 2019 13:01 — forked from cspanring/pip-install-gdal.md
Installing GDAL in a Python virtual environment

Installing GDAL in a Python virtual environment

Get gdal development libraries:

$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install libgdal-dev

Create and activate a virtual environment: