Skip to content

Instantly share code, notes, and snippets.

View guzmonne's full-sized avatar

Guzman Monne guzmonne

  • Uruguay
  • Montevideo, Uruguay
View GitHub Profile
var keycloak;
function init() {
// If the Keycloak constructor doesn't exist we'll throw
// an error.
if (window.Keycloak === undefined) {
throw new Error('Can\'t find Keycloak on the global scope');
}
// Later on the article we'll see what a `realm` and
// a `client` means in Keycloak.
@guzmonne
guzmonne / docker-compose.yml
Created July 19, 2019 14:14
Keycloak SSO - docker-compose.yml
---
version: '3.7'
services:
keycloak:
image: jboss/keycloak:6.0.1
environment:
- KEYCLOAK_USER=admin
- KEYCLOAK_PASSWORD=password
- DB_ADDR=postgres
- DB_PORT=5432
@guzmonne
guzmonne / App.jsx
Created July 19, 2019 14:13
Keycloak SSO
import React from 'react';
function App() {
return (
<Keycloak>
<div>Welcome!</div>
</Keycloak>
);
}
@guzmonne
guzmonne / main.go
Last active July 10, 2019 03:44
Web Server implementing queues with Go
package main
import (
"runtime"
"context"
_ "expvar"
"flag"
"fmt"
"sync/atomic"
"log"
@guzmonne
guzmonne / multi_observations.py
Created January 24, 2019 20:06
Download multiple files from S3 in multiple threads
import os
import math
from datetime import datetime, timedelta
from multiprocessing import Process, Queue, Lock, Manager
import boto3
from tqdm import tqdm
from utils import chunks, Logger, clear, tprint
from observations_1 import get_all_objects, object_worker, HOURS, MINUTES
PRODUCERS = 2
We can't make this file beautiful and searchable because it's too large.
airport_id,name,city,country,iata,icao,latitude,longitude,altitude,timezone,dst,tx,type,source
1,"Goroka Airport","Goroka","Papua New Guinea","GKA","AYGA",-6.081689834590001,145.391998291,5282,10,"U","Pacific/Port_Moresby","airport","OurAirports"
2,"Madang Airport","Madang","Papua New Guinea","MAG","AYMD",-5.20707988739,145.789001465,20,10,"U","Pacific/Port_Moresby","airport","OurAirports"
3,"Mount Hagen Kagamuga Airport","Mount Hagen","Papua New Guinea","HGU","AYMH",-5.826789855957031,144.29600524902344,5388,10,"U","Pacific/Port_Moresby","airport","OurAirports"
4,"Nadzab Airport","Nadzab","Papua New Guinea","LAE","AYNZ",-6.569803,146.725977,239,10,"U","Pacific/Port_Moresby","airport","OurAirports"
5,"Port Moresby Jacksons International Airport","Port Moresby","Papua New Guinea","POM","AYPY",-9.443380355834961,147.22000122070312,146,10,"U","Pacific/Port_Moresby","airport","OurAirports"
6,"Wewak International Airport","Wewak","Papua New Guinea","WWK","AYWK",-3.58383011818,143.669006348,19,10,"U","Pacific/Port_
We can't make this file beautiful and searchable because it's too large.
company,name,nation,year,month,airport_id,airport_name,origin_id,origin_region,origin_country,origin_continent,destination_id,destination_name,destination_uf,destination_region,destination_country,destination_continent,nature,group,paid_passengers,free_passengers,load,free_load,mail,ask,rpk,atk,rtk,fuel,distance,decolagens,paid_load,free_load_km,mail_km,seats,payload,hours,luggage
AAL,AMERICAN AIRLINES,ESTRANGEIRA,2018,1,KDFW,DALLAS/FORT WORTH,,,ESTADOS UNIDOS,AMÉRICA DO NORTE,SBGL,RIO DE JANEIRO - GALEÃO,RJ,SUDESTE,BRASIL,AMÉRICA DO SUL,Internacional,Regular,1190,79,12315,0,0,20587680,10007900,3532200,854161.65,,100920,12,103569150,0,0,2448,420000,,
AAL,AMERICAN AIRLINES,ESTRANGEIRA,2018,1,KDFW,DALLAS/FORT WORTH,,,ESTADOS UNIDOS,AMÉRICA DO NORTE,SBGR,SÃO PAULO - GUARULHOS,SP,SUDESTE,BRASIL,AMÉRICA DO SUL,Internacional,Regular,7977,307,255802,0,105430,81592000,65610825,14476000,7891945.075,,263200,32,2005411275,0,867161750,9920,1760000,,
AAL,AMERICAN AIRLINES,ESTRANGEIRA,2018,1,KJFK,NEW YORK,,,ESTADOS UNIDOS,
@guzmonne
guzmonne / Brush.js
Created January 24, 2018 19:13
nivo-brush - Brush.js
import React from 'react';
import compose from 'recompose/compose';
import pure from 'recompose/pure';
import withStateHandlers from 'recompose/withStateHandlers';
import withHandlers from 'recompose/withHandlers.js';
import { PADDING } from '../constants.js';
var Brush = ({
width,
height,
@guzmonne
guzmonne / flatten.js
Created November 15, 2017 19:38
flatten.js
/**
* Flattens an array of arbitrarily nested arrays into a flat array.
* E.g. [[1,2,[3]],4] -> [1,2,3,4].
* @param {array} array Array to be flatten.
*/
function flatten(array) {
array = array.reduce((acc, x) => acc.concat(x), []);
return array.every(x => Array.isArray(x) === false) === true
? array
: flatten(array)
@guzmonne
guzmonne / test.txt
Created July 26, 2017 20:21
prueba
Hola, mundo!
Hola como andas?