Skip to content

Instantly share code, notes, and snippets.

View vituchon's full-sized avatar

Vituchon vituchon

  • omnia salud
  • buenos aires
View GitHub Profile
@vituchon
vituchon / gist:54be5fcc836e1ff3dbd0bb1349a8b5af
Last active May 17, 2024 00:15
Análisis de temperatura dia a dia correspondiente al mes abril (04) del año 2024, usando datos de alerta del INA
FUENTE DE DATOS: https://alerta.ina.gob.ar/a5/secciones?generalCategory=&varId=&redId=&estacionId=&seriesId=32843&procId=&timestart=2024-04-01&timeend=2024-04-30&submit=&data_availability=h&west=&north=&east=&south=&cal_grupo_id=&cal_id=&forecast_date=&fuentesId=
Y me bajé un JSON... lo pase a CSV usando herramientas online https://data.page/json/csv
Luego
CREATE DATABASE "INA"
WITH
OWNER = postgres
ENCODING = 'UTF8'
@vituchon
vituchon / gist:71c9106adb8edc6702287f079c85605e
Created May 16, 2024 18:18
golang Http server - can not HOLD a panic inside a gorutine
haceme el favor... corre este código y averigualo por vos mismopackage main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/panic", func(w http.ResponseWriter, r *http.Request) {
panic("¡Esto es un panic!")
@vituchon
vituchon / gist:0b3d75286be5ce075c01f894f0bbc8bf
Created May 16, 2024 17:36
Golang mux webserver - Testing graceful shutdown behavior
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
#!/bin/sh
# diff is called by git with 7 parameters:
# path old-file old-hex old-mode new-file new-hex new-mode
kdiff3 "$2" "$5" | cat
function sumTableCells(tableId,cellIndex) {
var table = document.getElementById(tableId);
debugger;
let subTotal = Array.from(table.rows).reduce((total, row) => {
const textContent = row?.cells[cellIndex]?.textContent
return total + textContent ? parseInt(textContent.split(" ")[1].replace(",",".")) : 0
}, 0);
return subTotal
}
sumTableCells("table",5)
This file has been truncated, but you can view the full file.
Nabs Carlos
Alejandro Bologna
ANALIA ANTONIA ABALOS
María Pia Editadaaa Paz
Gonzalo Mauricio Coria
Usuario Sistema
Matias Buscaglia
Alexis Eme
Christian Sánchez
Cecilio Luis Cerisoli
@vituchon
vituchon / deferBuilder.ts
Last active April 21, 2023 13:21
Construyendo deferreds a manopla
function deferBuilder<T>() {
type resolveType = (value: T) => void;
interface resolveInterface { // no funca con interface :S
(value: T): void;
}
type rejectType = (reason?: any) => void
var resolve: resolveType;
var reject: rejectType
const promise = new Promise(function (_resolve: resolveType, _reject: rejectType) {
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
<script>
@vituchon
vituchon / postgres recipes
Last active January 31, 2024 17:23
Recetas caseritas del postgres
-- Consulta sobre el valor un miembro de primer nivel (para el caso, turnos que son sobreturnos)
select *
from appointments
where details ->> 'isOverturn' = 'true';
-- Consulta sobre el valor de un miembro de un nivel aninado (para el caso, los turnos con atención particular)
select *
from appointments
where details -> 'extra' ->> 'attentionBy' = 'particular'
package util
import com.redis._
import java.util.concurrent.Executors
import scala.concurrent.{Future, ExecutionContext}
trait Cache {
def get(key: String): Future[Option[String]]
def set(key: String, value: String, seconds: Long): Future[Boolean]
def ping(): Future[Boolean]