Skip to content

Instantly share code, notes, and snippets.

View palmerabollo's full-sized avatar

Guido García palmerabollo

View GitHub Profile
@palmerabollo
palmerabollo / carlos.js
Created January 1, 2021 12:19
Nombres que no incluyen letras de CARLOS
// source https://www.ine.es/daco/daco42/nombyapel/nombres_por_edad_media.xls
const names = [
"ANTONIO",
"MANUEL",
"JOSE",
"FRANCISCO",
"DAVID",
"JUAN",
"JOSE ANTONIO",
"JAVIER",
{
"swagger": "2.0",
"info": {
"description": "API with big latency",
"version": "1.0.0",
"title": "Latency API",
"termsOfService": "https://www.tid.es",
"contact": {
"name": "Fake Identity",
"email": "[email protected]"
# Dependencias urar y rarfile
# Instalar:
# Mac: brew install unrar | Ubuntu: apt-get install rar unrar
# pip install rarfile
import os
import shutil
import rarfile
# Descargar el archivo zip, si hay otro archivo con el mismo nombre lo sobreescribe
@palmerabollo
palmerabollo / httpserver.cpp
Created May 14, 2018 23:34
HTTP server with ESP32/ESP8266
// Legacy HTTP-based approach.
// For it to work, you need to call server.begin(); in the setup function and declare a WiFiServer server(80);
// see https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/SimpleWiFiServer/SimpleWiFiServer.ino
if (incomingClient) {
Serial.println("client connect");
digitalWrite(LED_PIN, LOW); // LOW = ON
while (incomingClient.connected()) {
if (incomingClient.available() > 0) {
<!-- https://www.playframework.com/documentation/latest/SettingsLogger -->
<configuration>
<conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<pattern>
<pattern>
#!/bin/bash
LOGGROUPS=$(awslogs groups | grep "/baikal/notifications-default-aws-dev/" | grep -v "mng")
for group in $LOGGROUPS; do
awslogs get $group ALL --start='10m ago' --filter-pattern=ERROR
done
@palmerabollo
palmerabollo / SignalHandler.java
Created June 30, 2017 10:54
SignalHandler to gracefully shutdown a Play 2.5 app
import akka.actor.ActorSystem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import play.api.inject.DefaultApplicationLifecycle;
import scala.concurrent.duration.Duration;
import scala.concurrent.duration.FiniteDuration;
import sun.misc.Signal;
import javax.inject.Inject;
import javax.inject.Singleton;
@palmerabollo
palmerabollo / DateParameter.java
Created June 27, 2017 14:51
Play 2.5 QueryStringBindable
package controllers.binders;
import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;
import play.mvc.QueryStringBindable;
import java.util.Date;
import java.util.Map;
import java.util.Optional;
@palmerabollo
palmerabollo / gist:9d7f83088e9c8b24f43fe20dc2ddddf2
Created June 8, 2017 07:16
Node HTTP server with delayed response
const http = require('http');
const url = require('url') ;
let server = http.createServer((req, res) => {
let query = url.parse(req.url, true).query;
res.writeHead(200, {'Content-Type': 'application/json'});
setTimeout(() => {
res.write(JSON.stringify({success: true}));
res.end();
@palmerabollo
palmerabollo / joke.fish
Created June 4, 2017 17:50
joke function for fish shell
function joke
if not type -q jq
echo 'JQ is not installed'
end
curl -s -H "Accept: application/json" https://icanhazdadjoke.com/ | jq -r .joke
end