Skip to content

Instantly share code, notes, and snippets.

View allixender's full-sized avatar

Alex Kmoch allixender

View GitHub Profile
@allixender
allixender / make_cog_from_tiff.sh
Created October 29, 2022 12:17
Make proper GeoTiff COG with overviews through GDAL
#!/bin/bash
# https://trac.osgeo.org/gdal/wiki/CloudOptimizedGeoTIFF
input=$1
output=$2
oversample="nearest" # or nearest, average
gdal_translate $1 interm_step1.tif -co TILED=YES -co COMPRESS=DEFLATE
@allixender
allixender / pyqgis.cmd
Created July 27, 2020 08:47
A custom Windows cmd init to develop QGIS 3 plugins
@echo off
SET OSGEO4W_ROOT=C:\dev\OSGeo4W
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
call "%OSGEO4W_ROOT%"\bin\qt5_env.bat
call "%OSGEO4W_ROOT%"\bin\py3_env.bat
@echo off
set PROJ_LIB=%OSGEO4W_ROOT%\share\proj
set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python37
set PYTHONPATH=%OSGEO4W_ROOT%\apps\Python37;%OSGEO4W_ROOT%\apps\Python37\Scripts;%OSGEO4W_ROOT%\apps\qgis-ltr\python
<!DOCTYPE connections>
<qgsXYZTilesConnections version="1.0">
<xyztiles name="Bing VirtualEarth" password="" referer="" authcfg="" url="http://ecn.t3.tiles.virtualearth.net/tiles/a{q}.jpeg?g=1" zmax="19" username="" zmin="1"/>
<xyztiles name="CartoDb Dark Matter" password="" referer="Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL." authcfg="" url="http://basemaps.cartocdn.com/dark_all/%7Bz%7D/%7Bx%7D/%7By%7D.png" zmax="20" username="" zmin="0"/>
<xyztiles name="CartoDb Positron" password="" referer="Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL." authcfg="" url="http://basemaps.cartocdn.com/light_all/%7Bz%7D/%7Bx%7D/%7By%7D.png" zmax="20" username="" zmin="0"/>
<xyztiles name="Esri Boundaries Places" password="" referer="" authcfg="" url="https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D" zmax="20" username="" zmin="0"/>
<xyztiles name="Esri Gray (dark)" pass
@allixender
allixender / geotransfer.sh
Last active March 4, 2020 09:15
GDAL/OGR local GeoPackage to cloud Postgresql/PostGIS with schema
# for direct psql access via ssl cert auth
# psql "sslmode=verify-ca sslrootcert=server-ca.pem sslcert=client-cert.pem sslkey=client-key.pem hostaddr=x.x.x.x user=postgres dbname=postgres"
./cloud_sql_proxy_x64.exe -instances=glomodat:europe-west:mybatabase=tcp:5432 &
ogr2ogr -s_srs EPSG:3301 -t_srs EPSG:4326 -f "PostgreSQL" PG:"host=localhost user=postgres dbname=postgres password=xxxxxx" -nln "estonia_soil_4326" -lco SCHEMA=geodata -lco GEOMETRY_NAME=geom -lco FID=fid -nlt PROMOTE_TO_MULTI -overwrite estonia_soil_v1.1.gpkg
@allixender
allixender / scrape_docx_pptx_demo.py
Created January 25, 2019 16:52
little remember-me demo for scraping text and stuff out of Word and Powerpoint files using python
from pptx import Presentation
from pptx.enum.shapes import MSO_SHAPE_TYPE
from docx import Document
import os
from pathlib import Path
for x in range(1,16,1):
num = "0" + str(x)
@allixender
allixender / README-tomcat-as-systemd-service.md
Created September 10, 2018 06:35 — forked from drmalex07/README-tomcat-as-systemd-service.md
An example configuration for Tomcat as systemd service. #tomcat #systemd #systemd.service

README

Let Tomcat is download and installed under /opt/tomcat. Also, let tomcat be a non-provileged user under which the server will be running.

We assume that we keep server's binaries under /opt/tomcat and we will create a server instance named foo under /var/tomcat/ (carrying its own conf, logs, webapps, work, lib directories). See also https://dzone.com/articles/running-multiple-tomcat.

Create a template service unit file at /etc/systemd/system/[email protected]:

package controllers;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import play.Logger;
import play.mvc.Controller;
@allixender
allixender / geotools-jai-build.sbt
Last active July 19, 2019 09:50
To get GeoTools dependencies for Scala/SBT with JAI right on public build servers like Travis
// val geotoolsVersion = "8.7"
val geotoolsVersion = "9.5"
// val geotoolsVersion = "10.8"
// val geotoolsVersion = "11.3"
// val geotoolsVersion = "12.0"
// val geotoolsVersion = "13-SNAPSHOT"
libraryDependencies ++= Seq(
"org.geotools" % "gt-epsg-hsql" % geotoolsVersion,
"org.geotools" % "gt-referencing" % geotoolsVersion,
cluster_name: 'Test Cluster'
hinted_handoff_enabled: true
max_hint_window_in_ms: 10800000 # 3 hours
hinted_handoff_throttle_in_kb: 1024
max_hints_delivery_threads: 2
batchlog_replay_throttle_in_kb: 1024
authenticator: AllowAllAuthenticator
authorizer: AllowAllAuthorizer
permissions_validity_in_ms: 2000
partitioner: org.apache.cassandra.dht.Murmur3Partitioner
@allixender
allixender / zoo-sagagis-buildscript.sh
Created April 15, 2016 00:57
ZOO-Project WPS offers integration with the SAGA GIS. The build chain takes some time an has a few traps. This build completes and the example request Garden_Fractals works, but a GRID sum causes a few spurious errors.
# ZOO-Project WPS offers integration with the SAGA GIS.
# The build chain takes some time an has a few traps.
# My build completes and the example request Garden_Fractals works,
# but a GRID sum causes SIGSEV11 errors and complete successfully
# .. although somestuff is working along the operation..
# apache2 log
## snip
error: line 18: character not allowed ';'
error: line 18: character not allowed ';'