Skip to content

Instantly share code, notes, and snippets.

View MBunel's full-sized avatar

Mattia Bunel MBunel

View GitHub Profile
@mkweskin
mkweskin / gist:5414303
Last active June 28, 2024 14:39
Convert markdown to mediawiki with pandoc
pandoc -f markdown -t mediawiki test.md -o test.wiki
# Thanks to @tillmanj for the updated formatting
@hubgit
hubgit / README.md
Last active June 14, 2024 17:40
Remove metadata from a PDF file, using exiftool and qpdf. Note that embedded objects may still contain metadata.

Anonymising PDFs

PDF metadata

Metadata in PDF files can be stored in at least two places:

  • the Info Dictionary, a limited set of key/value pairs
  • XMP packets, which contain RDF statements expressed as XML

PDF files

@clhenrick
clhenrick / README.md
Last active April 1, 2024 14:55
PostgreSQL & PostGIS cheatsheet (a work in progress)
@perrygeo
perrygeo / _partial_pixel_rasterization.md
Last active October 12, 2023 17:10
partial pixel rasterization

This is a proof-of-concept for a numpy/rasterio/shapely based implementation of partial coverage rasterization. It works, barely.

The current GDAL algorithms allow for two methods, both binary: the default centroid method and the all-touched method.

This is a third alternative which provides the percentage of coverage of each cell from 0 to 100 which can be thought of as pixel weights for many spatial analyses.

See discussion at rasterio/rasterio#232

@mturquette
mturquette / .offlineimaprc
Created January 18, 2016 06:29
OfflineIMAP nametrans and folderfilter example
[Repository local-baylibre]
...
nametrans = lambda folder: {
'drafts': '[Gmail]/Drafts',
'flagged': '[Gmail]/Starred',
'important': '[Gmail]/Important',
'inbox': 'INBOX',
'spam': '[Gmail]/Spam',
'trash': '[Gmail]/Trash',
}.get(folder, folder)
@Brainiarc7
Brainiarc7 / transient-clustering-gnu-parallel-sshfs.md
Last active April 21, 2024 05:16
How to set up a transient cluster using GNU parallel and SSHFS for distributed jobs (such as FFmpeg media encodes)

Transient compute clustering with GNU Parallel and sshfs:

GNU Parallel is a multipurpose program for running shell commands in parallel, which can often be used to replace shell script loops,find -exec, and find | xargs. It provides the --sshlogin and --sshloginfile options to farm out jobs to multiple hosts, as well as options for sending and retrieving static resources and and per-job input and output files.

For any particular task, however, keeping track of which files need to pushed to and retrieved from the remote hosts is somewhat of a hassle. Furthermore, cancelled or failed runs can leave garbage on the remote hosts, and if input and output files are large, sending them to local disk on the remote hosts is somewhat inefficient.

In a traditional cluster, this problem would be solved by giving all nodes access to a shared filesystem, usually with NFS or something more exotic. However, NFS doesn't wo

from qgis.core import QgsProject, QgsPointCloudLayer
# File url from the demo to download and uncompress
# https://wxs.ign.fr/c90xknypoz1flvgojchbphgt/telechargement/prepackage/LIDARHD_PACK_NP_2021$LIDARHD_1-0_LAZ_NP-0808_6307-2021/file/LIDARHD_1-0_LAZ_NP-0808_6307-2021.7z
# Add layer and add index automatically if not present
cl1 = QgsPointCloudLayer('LIDARHD_1-0_LAZ_NP-0808_6307-2021/Semis_2021_0808_6306_LA93_IGN69.laz', 'Semis_2021_0808_6306_LA93_IGN69', 'pdal')
if cl1.isValid():
QgsProject.instance().addMapLayer(cl1)
#!/usr/bin/env bash
# Working area in EPSG:2154
xmin=892000
ymin=6249000
xmax=894000
ymax=6247000
rm -rf footprints
mkdir footprints