Skip to content

Instantly share code, notes, and snippets.

@tobwen
tobwen / mindeps.py
Last active January 14, 2025 17:53 — 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 / 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 / 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 / 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 / typing_simulator.py
Last active November 28, 2024 02:38
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)