Skip to content

Instantly share code, notes, and snippets.

View fccoelho's full-sized avatar
🏠
Working from home

Flávio Codeço Coelho fccoelho

🏠
Working from home
View GitHub Profile
#!/usr/bin/env python
# coding: utf-8
# # Exercícios
# In[11]:
import pandas as pd
get_ipython().run_line_magic('pylab', 'inline')
@fccoelho
fccoelho / openapi.json
Created September 15, 2019 19:13
openApi
{"openapi": "3.0.0", "servers": [{"url": "http://localhost:8080"}], "info": {"title": "Hathor API", "version": "0.16.0-beta"}, "consumes": ["application/json"], "produces": ["application/json"], "paths": {"/p2p/peers": {"x-visibility": "private", "post": {"tags": ["p2p"], "operationId": "p2p_peers", "summary": "Add p2p peers", "description": "Connect to the given peers", "requestBody": {"description": "Peers you want to connect to", "required": true, "content": {"application/json": {"schema": {"type": "array", "description": "List of peers to connect in the format \"protocol:host:port\"", "items": {"type": "string"}}, "examples": {"peer_list": {"summary": "List of peers", "value": ["tcp:localhost:8000", "tcp:17.24.137.234:40403"]}}}}}, "responses": {"200": {"description": "The peers we connected to (we don't try connecting to already known peers)", "content": {"application/json": {"examples": {"success": {"summary": "Peers added", "value": {"success": true, "peers": ["tcp:localhost:8000", "tcp:17.24.137.234:4
@fccoelho
fccoelho / app.py
Last active September 9, 2019 20:56
Dash app with maps and plotly express
from flask import Flask
import plotly_express as px
import pandas as pd
import geopandas as gp
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
@fccoelho
fccoelho / fwf.csv
Created June 13, 2016 12:48
Pandas FWF bug
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
12 13 5 0 11AVENIDA GOVERNADOR EDMUNDO PINTO 72 ACRELANDIA 01 00100169945000
12 13 5 0 11AVENIDA GOVERNADOR EDMUNDO PINTO 72 ACRELANDIA
@fccoelho
fccoelho / Spark logistic regression.ipynb
Created July 9, 2015 12:20
PySpark Logistic regression
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fccoelho
fccoelho / PyDSTool_benchmark.ipynb
Last active August 29, 2015 14:23
Benchmark of ODE solvers
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fccoelho
fccoelho / benchMongoDict.py
Created May 26, 2015 12:45
MongoDict benchmark
"""
In [16]: %timeit dic_normal(1000)
1000 loops, best of 3: 802 µs per loop
In [17]: %timeit dic_mongo(1000)
1 loops, best of 3: 308 ms per loop
In [18]: dic2 = dic_normal(1000)
In [19]: %time col.insert(dic2)
CPU times: user 15.1 ms, sys: 600 µs, total: 15.7 ms
Wall time: 22.1 ms
"""
@fccoelho
fccoelho / Classifica_Artigos.ipynb
Created July 17, 2014 19:14
experimentos de classificação de artigos do MediaCLoud
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fccoelho
fccoelho / cgillespie.pyx
Created February 14, 2013 22:41
Cython based Gillespie algorithm
from numpy.random import uniform, multinomial, exponential
#from numpy import arange, array, empty,zeros
import numpy as np
cimport numpy as np
import time
from random import random
DTYPE = np.double
ctypedef np.double_t DTYPE_t
ctypedef np.int_t INT_t
@fccoelho
fccoelho / choropleth.js
Created November 27, 2012 23:09
D3.js map choroplethmap
<script src="/js/d3.v2.js"></script>
<link type="text/css" rel="stylesheet" href="/css/colorbrewer/colorbrewer.css">
<style type="text/css">
svg {
background: #eee;
width: 960px;
height: 500px;
}
#polygons path {
stroke: #fff;