Skip to content

Instantly share code, notes, and snippets.

View ferblape's full-sized avatar
🐧

Fernando Blat ferblape

🐧
View GitHub Profile
@ferblape
ferblape / axe_decidim-blogs_blogs-index.json
Created July 26, 2023 05:43
Decidim accessibility report
{
"violations": [
{
"description": "Ensures <img> elements have alternate text or a role of none or presentation",
"help": "Images must have alternate text",
"helpUrl": "https://dequeuniversity.com/rules/axe/4.7/image-alt?application=axeAPI",
"id": "image-alt",
"impact": "critical",
"nodes": [
{
@ferblape
ferblape / metabase.txt
Created February 27, 2023 02:26
Install Metabase using Dokku
## Previous steps ##
- Install Dokku package
- Setup the DNS of your domain
## Install Metabase ##
(run as root)
# install postgres plugin
@ferblape
ferblape / test.sql
Created December 6, 2020 06:44
Postgres ALTER COLUMN column typecasting
DROP TABLE IF EXISTS test;
CREATE TABLE test(col_integer varchar, col_numeric varchar, col_boolean varchar, col_date varchar, col_timestamp varchar, col_time varchar);
INSERT INTO test VALUES('1', '1.33', 'true', '2020-10-21', '2020-11-21 00:32:10', '10:32:10');
INSERT INTO test VALUES('2', '2.33', 'false', '2020-10-22', '2020-11-22 01:32:10', '10:31:10');
ALTER TABLE test ALTER COLUMN col_integer TYPE integer USING (col_integer::integer);
ALTER TABLE test ALTER COLUMN col_numeric TYPE numeric USING (col_numeric::numeric);
ALTER TABLE test ALTER COLUMN col_boolean TYPE boolean USING (col_boolean::boolean);
ALTER TABLE test ALTER COLUMN col_date TYPE timestamp USING (col_date::timestamp);
ALTER TABLE test ALTER COLUMN col_timestamp TYPE timestamp USING (col_timestamp::timestamp);
ALTER TABLE test ALTER COLUMN col_time TYPE time USING (col_time::time);
@ferblape
ferblape / disable_retweets.rb
Created July 24, 2020 08:53
Disable all your contact retweets
require "twitter"
# 1. Go to https://developer.twitter.com/en/apps
# 2. Create a new app with write permission
# 3. Copy and paste the tokens
API_KEY = ""
API_SECRET = ""
ACCESS_TOKEN = ""
ACCESS_TOKEN_SECRET = ""
@ferblape
ferblape / index.html
Last active May 19, 2020 14:12
Demo Leaflet
<html>
<head>
<title>Secciones Censales Getafe</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"></script>
<style>
#map { height: 100%; width: 100%; }
</style>
</head>
<body>
@ferblape
ferblape / ruby-imap.rb
Created January 16, 2020 17:21
IMAP Ruby idle sample
require "net/imap"
email = "xxxxx@foo.com"
password = "xxxxxx"
server = "imap.xxxxx.com"
imap = Net::IMAP.new(server, 993, true)
imap.login(email, password)
def process_emails
@ferblape
ferblape / Pipeline.groovy
Created November 12, 2019 17:22
Pipeline example
email = "errors@example.com"
pipeline {
agent any
environment {
PATH = "/home/ubuntu/.rbenv/shims:$PATH"
GOBIERTO_ETL_UTILS = "/var/www/gobierto-etl-utils/current/"
ETL = "/var/www/gobierto-etl/current/"
GOBIERTO = "/var/www/gobierto/current/"
}
stages {
@ferblape
ferblape / population-analysis-sample.R
Created July 29, 2019 12:51
Sample of historical population analysis using Populate Data
# Load dependencies
library(tidyverse)
library(httr)
library(ggplot2)
library(bbplot)
# Set seed
set.seed(14723)
# Set working directory
@ferblape
ferblape / ine_intercensal.rb
Created May 23, 2019 12:10
Scrap INE > Alteraciones de los municipios en los Censos de Población desde 1842
# Fetch data from https://www.ine.es/dyngs/INEbase/es/operacion.htm?c=Estadistica_C&cid=1254736176998&menu=resultados&idp=1254735572981
require "nokogiri"
require "byebug"
require "json"
url = "https://www.ine.es/intercensal/intercensal.do"
uri = URI.parse(url)
data = {}
INE::Places::Province.all.each do |province|