Skip to content

Instantly share code, notes, and snippets.

View ferblape's full-sized avatar
🐧

Fernando Blat ferblape

🐧
View GitHub Profile
@ferblape
ferblape / gist:4f94556befffb237ca4ae16b51911c47
Created September 4, 2024 05:26 — forked from sytsereitsma/gist:1b370c558a4a34dfe014
[Jenkins] Clear build queue and cancel all builds
def q = Jenkins.instance.queue
q.items.findAll { q.cancel(it.task) }
//q.items.findAll { it.task.name.startsWith('my') }.each { q.cancel(it.task) }
def items = Jenkins.instance.items
items.each { job ->
job.builds.findAll { build -> build.building }.each { run ->
println("Aborting: " + job.name)
run.doStop();
}
@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/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/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 = "[email protected]"
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 = "[email protected]"
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