Skip to content

Instantly share code, notes, and snippets.

View enricofer's full-sized avatar
👻
I may be slow to respond.

enrico ferreguti enricofer

👻
I may be slow to respond.
View GitHub Profile
@enricofer
enricofer / layer_from_WKT_algorithm.py
Created September 29, 2022 17:35
QGIS processing algoritm for getting a layer from a WKT definition
# -*- coding: utf-8 -*-
"""
***************************************************************************
* *
* 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. *
* *
@enricofer
enricofer / wikipedia_in_qgis_expressions.py
Created June 28, 2022 15:26
A set of QGIS expressions functions for wikipedia search and informations extraction
from qgis.core import *
from qgis.gui import *
import wikipedia
@qgsfunction(args='auto', group='wikipedia')
def wiki_set_lang(value, feature, parent):
"""
Sets global wikipedia_language Variable
<h2>Example usage:</h2>
<ul>
@enricofer
enricofer / listS3.py
Last active January 10, 2023 22:07
List s3 public bucket objects without AWS credentials
# pip install boto3
import boto3
import botocore
s3client = boto3.client('s3', region_name='eu-central-1') #specify aws region
#exclude credential signing, otherwise, without providind AWS credential you will get a "NoCredentialsError"
s3client.meta.events.register('choose-signer.s3.*', botocore.handlers.disable_signing)
objects = s3client.list_objects(Bucket='vito.landcover.global')
for item in objects["Contents"]:
print (item["key"])
@enricofer
enricofer / sql
Last active April 24, 2018 14:01
SELECT
p1.cat,
p1.id_dato,
p1.numero_str,
p2.distanza_dal_precedente,
coalesce(p2.cat_precedente, 0) as cat_precedente,
coalesce(p2.accumulo_distanze, 0)
FROM
edit_percorso_point as p1
INNER JOIN LATERAL (
### Keybase proof
I hereby claim:
* I am enricofer on github.
* I am enricofer (https://keybase.io/enricofer) on keybase.
* I have a public key ASD1izS5lZxC7iilKpgUGgtCUCED-qRP6ecZcXloMVjpCgo
To claim this, I am signing this object: