Skip to content

Instantly share code, notes, and snippets.

Avatar

Manuel Garrido manugarri

View GitHub Profile
View gist:f5d4efbdba44fadb3a912261f36c7f17
{
"cells": [
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
@manugarri
manugarri / render_json.py
Created Nov 9, 2018
widget to display json in jupyter notebook
View render_json.py
import uuid
from IPython.display import display_javascript, display_html, display
import json
class RenderJSON(object):
def __init__(self, json_data):
if isinstance(json_data, dict):
self.json_str = json.dumps(json_data)
else:
self.json_str = json
View evaluation.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@manugarri
manugarri / kafka-cheat-sheet.md
Created Oct 24, 2018 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka
View kafka-cheat-sheet.md

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@manugarri
manugarri / Structured_with_text.py
Created Oct 20, 2018 — forked from ranihorev/Structured_with_text.py
PyTorch module for classification or regression of categorical+continuous+text inputs. This module is based on fast.ai library
View Structured_with_text.py
from fastai.text import *
from fastai.structured import proc_df
import pandas as pd
import numpy as np
class MixedInputModelWithText(nn.Module):
def __init__(self, emb_szs, n_cont, emb_drop, out_sz, szs, drops,
y_range=None, use_bn=False, is_reg=True, is_multi=False, n_text=0):
super().__init__()
for i, (c, s) in enumerate(emb_szs): assert c > 1, f"cardinality must be >=2, got emb_szs[{i}]: ({c},{s})"
@manugarri
manugarri / cookie_read_test.go
Created Apr 19, 2018 — forked from jonnyreeves/cookie_read_test.go
Testing Cookie Writes in Golang
View cookie_read_test.go
View gist:bce47dcc6fbcdc441b916987be22e826
diccionario_columnas = {
"belongs_to_collection": "franquicia",
"budget": "presupuesto",
"genres": "genero",
"homepage": "pagina_web",
"original_language": "lenguaje",
"popularity": "popularidad",
"poster_path": "poster",
"production_companies": "productores",
"production_countries": "pais",
@manugarri
manugarri / config
Created Dec 19, 2017 — forked from gerardorf/config
bastion ssh configuration. Add this config on ~/.ssh/config
View config
Host *.gerardorf.org !bastion.gerardorf.org
User admin
IdentityFile ~/.ssh/gerardorf-private-key
ProxyCommand ssh -W %h:%p admin@bastion.gerardorf.org
Host bastion.gerardorf.org
Hostname XXX.XXX.XXX.XXX
User admin
IdentityFile ~/.ssh/gerardorf-private-key
ForwardAgent yes
@manugarri
manugarri / parse_borme.py
Created Mar 20, 2017
Herramienta para descargarse de forma rapida los datos del boletin del registro mercantil, borme.
View parse_borme.py
#! /usr/bin/env python
"""
Herramienta para descargarse datos historicos del Boletin Oficial del Registro Mercantil.
Para usar:
>> python parse_borme.py INICIO_FECHA FIN_FECHA REGIONES OUTPUT
con:
- INICIO_FECHA es la fecha de inicio que se desea procesar, en formato %Y-%m-%d
- FIN_FECHA es la fecha final que se desea procesar, en formato %Y-%m-%d
- REGIONES son una lista de regiones separadas por coma que se desean, por ejemplo MURCIA,MADRID,BARCELONA
View Intro a Jupyter notebook.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.