Skip to content

Instantly share code, notes, and snippets.

@tobwen
tobwen / typing_simulator.py
Last active November 4, 2024 18:40
human typing simulator
# This code is under license CC0.
import argparse
import random
import sys
import time
from typing import List, Tuple
import datetime
# Keyboard layout mapping for common typos (QWERTY layout)
@tobwen
tobwen / ZteModemClient.py
Created September 28, 2024 16:18
ZteModemClient
# hint: developed for and tested with ZTE ZTE MF79U (version BD_XCBZHKMF79UV1.0.0B03)
import requests
import hashlib
import re
import logging
from typing import Dict, Any, Tuple
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
@tobwen
tobwen / qgis_MapExporter.py
Last active September 18, 2024 23:47
QGIS: MapExporter using QPainter()
from qgis.core import QgsProject, QgsMapSettings, QgsRectangle, QgsMapRendererCustomPainterJob
from qgis.PyQt.QtGui import QImage, QPainter
from PyQt5.QtCore import QSize
from pathlib import Path
import time
class MapExporter:
def __init__(self, canvas):
self.canvas = canvas
self.project = QgsProject.instance()
@tobwen
tobwen / Dockerfile
Last active November 4, 2023 06:56
PostGIS Debian OCI
# commits to be built
ARG CGAL55_GIT_COMMIT=tags/v5.6 # https://github.com/CGAL/cgal/tags
ARG SFCGAL_GIT_COMMIT=tags/v1.5.0 # https://github.com/Oslandia/SFCGAL_CI/tags
ARG PROJ_GIT_COMMIT=tags/9.3.0 # https://github.com/OSGeo/PROJ/tags
ARG GEOS_GIT_COMMIT=tags/3.12.0 # https://github.com/libgeos/geos/tags
ARG GDAL_GIT_COMMIT=tags/v3.7.3 # https://github.com/OSGeo/gdal/tags
ARG POSTGIS_GIT_COMMIT=tags/3.4.0 # https://github.com/postgis/postgis/tags
# base container with build-dependencies
FROM docker://postgres:16-bookworm AS build-deps
@tobwen
tobwen / mindeps.py
Last active April 8, 2023 08:39 — forked from huitseeker/mindeps.py
Minimizes a list of debian packages by removing those implied as dependencies of the others
#!/usr/bin/env python3
#######################################################################
# This program is free software; you can redistribute it and/or #
# modify it under the terms of the GNU General Public License as #
# published by the Free Software Foundation; either version 2 of the #
# License, or (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, but #
# WITHOUT ANY WARRANTY; without even the implied warranty of #
@tobwen
tobwen / example-maplibre-gl-leaflet-html
Created November 8, 2022 00:06
basemap.de Web Vektor - MapLibre GL Leaflet Demo
<!DOCTYPE html>
<html>
<head>
<title>basemap.de Web Vektor - Leaflet Demo</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<style>
body {
margin: 0;
padding: 0;
@tobwen
tobwen / INSPIRE Verwaltungseinheiten DE.md
Last active July 14, 2022 22:15
INSPIRE Verwaltungseinheiten DE

WFS-Download

dl_wfs_1() {
    curl --insecure --location --remote-time --create-dirs --get \
    --url "$1" \
    --data "service=WFS" \
    --data "request=GetFeature" \
    --data "version=1.1.0" \
 --data "resultType=results" \
@tobwen
tobwen / gdal-raster.md
Last active January 21, 2022 13:06
`.geoTransform` is off in different raster formats

version

GDAL 3.4.1, released 2021/12/27

get source cache (mbtile)

curl -kJLOR "https://daten.gdz.bkg.bund.de/produkte/topplus_open/TopPlusOpen/aktuell/mercator/9.mbtile"
cp 9.mbtile 9.mbtiles

create extracts

@tobwen
tobwen / nw_3035.md
Last active May 23, 2020 09:29
Variants to generate an INSPIRE-compliant grid in EPSG:3035 for Germany's federal state Northrhine-Westfalia in PostGIS
@tobwen
tobwen / wronxit.geojson
Created October 29, 2019 18:27
NEVER `buffer with 0`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.