Skip to content

Instantly share code, notes, and snippets.

View allixender's full-sized avatar

Alex Kmoch allixender

View GitHub Profile
@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/tomcat@.service:

@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 / 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
<!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 / 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
@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