Skip to content

Instantly share code, notes, and snippets.

@jlstanus
jlstanus / create_gpkg_table.sql
Last active February 27, 2019 13:23
Exemple of Geopackage creation with SQL
CREATE TABLE 'new_alert_zone_layer' (
id INTEGER PRIMARY KEY AUTOINCREMENT,
geometry MULTIPOLYGON NOT NULL,
LayerNameFr TEXT DEFAULT 'New Layer',
LayerNameNl TEXT DEFAULT 'New Layer',
NameNl TEXT NOT NULL,
NameFr TEXT NOT NULL,
Category TEXT NOT NULL DEFAULT 'INFO',
Buffer INTEGER NOT NULL DEFAULT 0,
'From' TEXT NOT NULL,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Proxy Server

Why?

FR

Set up a proxy

In this step we will setup an apache proxy server: Our server is an ubuntu server (18.04.2).

@jlstanus
jlstanus / agenda.md
Last active May 1, 2020 15:16
Incubhacker - Demo FreeCAD

Incubhacker: Demo FreeCAD

Introduction

# Create a line to show the distance between points
# http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html
# 'select EnableGpkgAmphibiousMode()' to enable sql query on geopackage
select
cNewg.address,
MakeLine(cNewg.geometry, cOldg.geometry) as geometry
from
(select Newg.rue_txt || Newg.numero as address, Newg.geometry
from Newg
@jlstanus
jlstanus / BlenderGIS How-to
Last active May 13, 2020 19:27
add sources
# BlenderGIS
## Requirements
* Download [Blender](https://www.blender.org/download/)
* Download [Blender GIS](https://github.com/domlysz/BlenderGIS)
* Install Blender GIS from *Edit > Preferences > Addon > Install*
* Install Node addon too
## Normal Process (easy)
-- Classic triggers for geopackages DB files
-- 1. Creation date
CREATE TRIGGER "trigger_add_creation_date" AFTER INSERT
ON "table_name"
BEGIN
UPDATE table_name SET attribute = datetime('now') WHERE fid = NEW.fid;
END
-- 2. Update date
CREATE TRIGGER "trigger_update_date" AFTER UPDATE
@jlstanus
jlstanus / system_backup.sh
Last active October 8, 2021 15:13
RPI Backup
#!/bin/bash
#
# Automate Raspberry Pi Backups
# Inspired from https://raw.githubusercontent.com/kallsbo/BASH-RaspberryPI-System-Backup/master/system_backup.sh
# Kristofer Källsbo 2017 www.hackviking.com
#
# Usage: system_backup.sh {path} {days of retention}
#
# Below you can set the default values if no command line args are sent.
# The script will name the backup files {$HOSTNAME}.{YYYYmmdd}.img
import time
from network import WLAN
from machine import Pin, PWM
from umqtt.simple import MQTTClient
from ubinascii import hexlify
import sys
CLIENT_ID = "smashing-sub"
MQTT_SERVER = "192.168.1.10"