Skip to content

Instantly share code, notes, and snippets.

View lgaticaq's full-sized avatar

Leonardo Gatica lgaticaq

View GitHub Profile

Keybase proof

I hereby claim:

  • I am lgaticaq on github.
  • I am lgatica (https://keybase.io/lgatica) on keybase.
  • I have a public key whose fingerprint is 7AD4 6B59 74CB 9DBD C855 EDE1 103A 20A2 D021 2902

To claim this, I am signing this object:

@lgaticaq
lgaticaq / send-to-slack.sh
Created September 16, 2016 20:41
Send a simple message to slack
#!/bin/sh
# Usage: send-to-slack <channel> <text>
# Example: send-to-slack random Hello world
# Set your slack token and domain with:
# export SLACK_TOKEN=your-slack-token
# export SLACK_USERNAME=some-username
if [[ $SLACK_TOKEN == "" ]]
@lgaticaq
lgaticaq / bomberos.csv
Last active June 15, 2017 18:04
Obtener todas las direcciones de los bomberos de chile
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 9.
"address","commune","country","latitude","longitude","name","phone","region"
"Vicuña Mackenna 802","Arica","Chile","-18.480781","-70.311448","Cuerpo de Bomberos de Arica","+56582257614","Región de Arica y Parinacota"
"Los Alamos 3007","Alto Hospicio","Chile","-20.268843","-70.104428","Cuerpo de Bomberos de Santa Rosa De Huantajaya","+56572499871","Región de Tarapacá"
"Noruega S/N","Alto Hospicio","Chile","-20.294159","-70.1043","Cuerpo de Bomberos de Alto Hospicio","+56572499390","Región de Tarapacá"
"Arturo Prat S/N","Camiña","Chile","-19.312723","-69.425425","Cuerpo de Bomberos de Camiña","+56562069541","Región de Tarapacá"
"Eleuterio Ramirez S/N","Huara","Chile","-19.996948","-69.772806","Cuerpo de Bomberos de Huara","+56572752550","Región de Tarapacá"
"Bolívar 414","Iquique","Chile","-20.21241","-70.152029","Cuerpo de Bomberos de Iquique","+56572413166","Región de Tarapacá"
"Barboza S/N","Pica","Chile","-20.490392","-69.328794","Cuerpo de Bomberos de Pica","+56572741377","Región de Tarapacá"
"Aldunate 650
@lgaticaq
lgaticaq / prts.json
Created February 28, 2018 21:55
Listado de plantas de revisión técnica
[{
"codigo": "A-1303",
"prt": "CERRILLOS / REVISIONES TÉCNICAS UVT S.A",
"lat": -33.5295219,
"lon": -70.7065183
}, {
"codigo": "B-1353",
"prt": "CERRILLOS / SGS CHILE LTDA.",
"lat": -33.520677,
"lon": -70.714736
@lgaticaq
lgaticaq / get_fingerprint_amazon_format.sh
Created March 28, 2018 10:35
Get ssh fingerprint in amazon format
SSH_PUBLIC_KEY_PATH=~/.ssh/id_rsa.pub
openssl rsa -RSAPublicKey_in -in <(ssh-keygen -f $SSH_PUBLIC_KEY_PATH -e -m PEM) -inform PEM -outform DER 2>/dev/null | openssl md5 -c | awk '{print $2}'
@lgaticaq
lgaticaq / dni_peru_validate.js
Last active May 17, 2022 19:19
Función para validar DNI Peruano
/**
* Verifica que un DNI de Perú sea valido
* @param {String} data DNI
* @returns {Boolean}
*/
const validate = data => {
const dni = data.replace('-', '').trim().toUpperCase()
if (!dni || dni.length < 9) return false
const multiples = [3, 2, 7, 6, 5, 4, 3, 2]
const dcontrols = {
@lgaticaq
lgaticaq / Dockerfile
Created October 3, 2019 22:28
Radicale
FROM python:3.7.4-alpine3.10
# Version of Radicale (e.g. 2.1.11)
ARG VERSION=2.1.11
# Install dependencies
RUN apk add --no-cache build-base libffi-dev
# Install Radicale
RUN wget --quiet https://github.com/Kozea/Radicale/archive/${VERSION}.tar.gz --output-document=radicale.tar.gz && \
#!/usr/bin/env sh
VERSION=$(curl -s "https://hub.docker.com/v2/repositories/gitlab/gitlab-runner/tags/?page_size=50" | sed "s/,/\n/g" | grep name | cut -d '"' -f 4 | grep -E "^v[0-9]+.[0-9]+.[0-9]+$" | sort -r | head -n 1)
docker pull "gitlab/gitlab-runner:$VERSION"
docker stop gitlab-runner && docker rm gitlab-runner
docker run -d --name gitlab-runner --restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
"gitlab/gitlab-runner:$VERSION"
@lgaticaq
lgaticaq / docker-secrets-to-envs.sh
Created April 6, 2021 21:30
Docker entrypoint to add docker secrets to environment variables
#!/usr/bin/env sh
set -e
file_env() {
envName=$1
secretName="${1}_FILE"
eval var=\$"$envName"
eval fileVar=\$"$secretName"
def="${2:-}"