Skip to content

Instantly share code, notes, and snippets.


Jorge Sanz jsanz

View GitHub Profile
jsanz /
Created Jun 4, 2021
[SPARQL] Country websites ping

Ping sites

This is a CSV with country official websites from all the world, and a simple script that randomly access to five of them every five seconds. The objective of this is to hit as many different country IP's as possible.

The CSV is obtained from this SPARQL query to Wikidata:

  (SAMPLE(?website) as ?web) 
jsanz /
Created Apr 30, 2021
Python: get FOSS4G 2021 abstracts into a JSON file

This simple scripts scraps the FOSS4G Community Review pages to convert the abstracts into a JSON file that will contain for each abstract:

  • Page number
  • Title
  • Abstract in HTML
  • Your score if it exists

Requirements: Python 3, [BeautifulSoup][bs], and [Requests][req]

It expects a FOSS4G_ID environment variable that is the variable part of the URL that you get when you sign in for the community review:{FOSS4G_ID}/.

jsanz / mbtiles_delete_zoom_level.sql
Created Apr 22, 2021 — forked from zhm/mbtiles_delete_zoom_level.sql
Delete zoom levels from an MBTiles file (set max zoom)
View mbtiles_delete_zoom_level.sql
-- change 18 to whatever the max zoom level you want in your MBTiles
tile_id IN (SELECT tile_id FROM map WHERE zoom_level > 18) AND
tile_id NOT IN (SELECT tile_id FROM map WHERE zoom_level <= 18);
DELETE FROM map WHERE zoom_level > 18;
UPDATE metadata SET value = '18' WHERE name = 'maxzoom';
jsanz /
Last active Dec 5, 2019
Docker wrapper for OGR commands

Simple wrappers around docker and OGR commands to expose ogr2ogr and ogrinfo using the latest builds. You need to be careful to always put absolute paths to your local data so the docker image can access it.

jsanz /
Created Oct 30, 2019
Python - QGIS - Fix geometries
Small script to fix geometries of the first file argument
using the native QGIS processing algorithm. You may need
to adjust the path to you installation.
import sys
from processing.core.Processing import Processing
jsanz / docker-compose.yml
Last active Oct 14, 2019
Docker Compose: Elastic Search/Kibana 7.4 cluster
View docker-compose.yml
# Minimal Docker Compose cluster for ElasticSearch and Kibana 7.4
# Put this file any folder creating "logs" and "esdata" folders
# to persist the cluster indices and kibana state
version: "3"
container_name: elasticsearch
jsanz /
Created Jul 27, 2019
Python: Download Instagram pictures
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
get_ipython().system('pip3 install -U InstagramApi')
# In[37]:
jsanz /
Last active Apr 22, 2019
Python: word cloud of FOSS4G 2019 submissions
jsanz /
Last active Jun 28, 2019
Leaflet Geocoder with CARTO.js

Just a minimal CARTO.js example with the defalut Leaflet Control Geocoder.

Simply add the JS and CSS imports

<!-- Geocoder-->
<link rel="stylesheet" href="" />
<script src=""></script>
jsanz /
Last active Aug 25, 2021
CARTO VL + Airship + Vue component

Minimal example on how to wrap Airship components as a Vue ones and then use them on a CARTO VL visualization. This just outlines the procedure explained in the Airship + Vue guide.

On this minimal example a layer switcher component is used to handle the UI so it only knows about its state, and then emits input methods to the parent Vue instance to allow mapping the boolean property of the sweitcher and then react to changes on it on the layer.

A range slider is used twice (to show component reusability) to allow filtering the visualization by a couple of fields.

Check also how the isLayerVisible computed variable is used for conditional rendering of several classes and widgets disable.