Skip to content

Instantly share code, notes, and snippets.

View jarnaldich's full-sized avatar

Joan Arnaldich jarnaldich

View GitHub Profile
@jarnaldich
jarnaldich / build.pro
Last active November 27, 2023 16:40
[Prolog as a build tool] Example for using Prolog to build something #prolog #make
:- use_module(library(http/http_open)).
:- use_module(library(http/http_client)).
:- use_module(library(uri)).
:- use_module(library(zip)).
:- use_module(library(pcre)).
:- initialization(main, main).
download(URL, File) :-
print_message(informational, ['Downloading', File]),
@jarnaldich
jarnaldich / xml.st
Created March 21, 2023 13:40
[XML Processing in Pharo] #xml #pharo #smalltalk
Gofer it
smalltalkhubUser: 'PharoExtras' project: 'XMLParserHTML';
configurationOf: 'XMLParserHTML';
loadStable.
Gofer it
smalltalkhubUser: 'PharoExtras' project: 'XPath';
configurationOf: 'XPath';
loadStable.
@jarnaldich
jarnaldich / NearDuplicates.ipynb
Created March 18, 2023 08:25
[Near Duplicate Detection] #data #qc #jupyter #python #nltk #jaccard #levenshtein
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jarnaldich
jarnaldich / PythonJSONPHelper.ipynb
Last active January 29, 2023 08:40
[JSONP Helper] in JupyterLite #cors #jupyterlite #python #javascript
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jarnaldich
jarnaldich / delete_from_all_tables.sql
Created December 13, 2022 06:05
[ Delete from all tables in SQLITE ] Script to delete all tables from SQLITE #sqlite #sql #metaprogramming
.output wipe.sql
select 'DELETE FROM ' || name || ';' FROM sqlite_master WHERE type='table';
.output
.read wipe.sql
@jarnaldich
jarnaldich / RasterGeoPackage.ps1
Created September 6, 2022 08:52
[Raster GeoPackage with Custom Tile Schema] Sample on generating a Raster GeoPackage with a Custom Tile Schema with GDAL 3 #gdal #geopackage #raster
function GetInfo {
param([string]$InputPath)
gdalinfo -json $InputPath | ConvertFrom-JSon -AsHashTable
}
function Urbana {
param(
[string]$InputPath,
[string]$OutputPath,
[String[]]$Bands=(1, 2, 3))
@jarnaldich
jarnaldich / catastro.ps1
Created April 20, 2022 05:46
[Catastro WebService Query in PowerShell] Query and process Xml Result for Catastro in PowerShell #xml #PowerShell #webservice
function Consulta_DPNRC($cod_parcela) {
$response = Invoke-WebRequest -UseBasicParsing -Uri "http://ovc.catastro.meh.es/ovcservweb/OVCSWLocalizacionRC/OVCCallejero.asmx/Consulta_DNPRC" `
-Method "POST" `
-WebSession $session `
-Headers @{
"Accept"="text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
"Accept-Encoding"="gzip, deflate"
"Accept-Language"="es-419,es;q=0.9,en;q=0.8"
"Cache-Control"="no-cache"
@jarnaldich
jarnaldich / out.py
Created March 28, 2022 09:54
[TFW from GCPs with RasterIO] #gdal #rasterio
from affine import dumpsw
ts = rio.transform.from_gcps(ds.gcps[0])
open(r"e:\public\aerot\1988040011117.tfw", 'w').write(dumpsw(ts))
@jarnaldich
jarnaldich / etl.hs
Last active March 26, 2022 21:26
[ETL in Haskell] Enrich a geojson file with attributes coming from an .xml #haskell #xml #geojson
#!/usr/bin/env stack
{-
stack
--install-ghc runghc
--package aeson
--package lens-aeson
--package xml-lens
-}
{-# Language OverloadedStrings #-}
import Control.Monad.Reader
@jarnaldich
jarnaldich / xml2json.hs
Created March 18, 2022 18:07
XML to JSON in Haskell sample #haskell #json #xml
#!/usr/bin/env stack
{-
stack
--install-ghc runghc
--package aeson
--package aeson-pretty
--package lens-aeson
--package xml-lens
-}
{-# LANGUAGE OverloadedStrings #-}