Skip to content

Instantly share code, notes, and snippets.

@AbelVM
AbelVM / readme.md
Created November 5, 2024 08:51
Painless HTTPS in VSCode LiveView

Painless HTTPS in VSCode LiveView

Minimal setup in Debian flavoured Linux

  1. Install MKCert (actually, there's an official apt package available, so you can just apt install mkcert)
  2. Locate your VSCode User folder, usually at ~/.config/Code/{my_user_name}/
  3. Make a subfolder for your certificates ~/.config/Code/{my_user_name}/certs
  4. Create your certificates
@AbelVM
AbelVM / twitter_cleaner.md
Created August 10, 2024 09:35
Twitter interests profiling cleaner

While logged in Twitter, go to

https://x.com/settings/your_twitter_data/twitter_interests

You will see a bunch of subjects that Twitter thinks you're interested on. Clicking all the checkboxes manually is a pain in the ass, so...

Open dev tools (F12, command + i, whatever), and go to Network tab to monitor everything

Open the console and run

@AbelVM
AbelVM / maplibre_lookat.js
Created July 3, 2024 12:33
Little MapLibre extension to easily set the PoV
/*
Abel Vázquez Montoro, 2022
https://github.com/maplibre/maplibre-gl-js/issues/1599
This function sets the camera PoV based on the 3D point the user want to focus on
and the attitude of the camera.
Parameters:
@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

#!/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 August 15, 2024 14:17
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