Skip to content

Instantly share code, notes, and snippets.

@AbelVM
AbelVM / readme.md
Last active May 22, 2023 15:22
SDSC23

SDSC23: Usando SQL para escalar tu analítica espacial

Prerequisitos

Una cuenta trial de CARTO. Todos los datos usados en este taller están disponibles en abierto dentro de la plataforma.

Vamos a utilizar CARTO en este taller y el motor de base de datos que lo respalda es BigQuery, así que el código SQL hace uso de las funciones y eventuales peculiaridades de dicho motor y de las extensiones de CARTO.

1. Algunos conceptos básicos

@AbelVM
AbelVM / updater.sh
Last active February 16, 2023 07:38
#!/bin/zsh
autoload colors && colors
echo ''
echo $fg_bold[magenta] 'Let`s update everything...'$reset_color
echo ''
echo $fg_no_bold[green] '1. Snap'$reset_color
if ! command -v snap &> /dev/null
then
echo $fg_no_bold[yellow] 'There`s no app installed via Snap'$reset_color
else
@AbelVM
AbelVM / README.md
Last active August 10, 2021 12:39
[UNTESTED] Live source for MapLibreGL JS

[UNTESTED] Live source for MapLibreGL JS

Lets say you need to refresh your tiles every X seconds to render live information, let's make use of Custom Protocos support.

Let's say your tiles are timestamped using epoc, and the endpoint reacts to URI params like this example

https://example.com/12/2005/1545.pbf?timestamp=1628597308254

Then you just

@AbelVM
AbelVM / freespace.sh
Last active September 4, 2023 11:48
ubuntu free space script
#!/bin/zsh
autoload colors && colors
echo ''
echo $fg_bold[magenta] 'Let`s free some disk space...'$reset_color
echo ''
echo $fg_no_bold[green] '1. journal space'$reset_color
journalctl --disk-usage
echo ''
sudo journalctl --rotate
echo ''
@AbelVM
AbelVM / LICENSE
Last active November 3, 2023 16:09
ST_KDensity: a simple spatial kernel density function for PostGIS
The MIT License (MIT)
Copyright (c) 2018 Abel Vázquez Montoro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
WITH
input_query as(
SELECT
*
FROM airports
order by cartodb_id asc
limit 1000
),
moran as(
SELECT
@AbelVM
AbelVM / 0_query.sql
Last active June 23, 2018 04:15
geocoding + routing + named + static
WITH point1 AS (
SELECT cdb_geocode_postalcode_point(<%= postcode1 %>, 'USA') as geo
),
point2 AS (
SELECT cdb_geocode_postalcode_point(<%= postcode2 %>, 'USA') as geo
),
route AS (
SELECT
r.shape as geo,
r.length