Skip to content

Instantly share code, notes, and snippets.

View fernandojunior's full-sized avatar

Fernando Felix fernandojunior

  • Brazil
View GitHub Profile
# import classification module
from pycaret.classification import *
# init setup
clf1 = setup(data, target = 'name-of-target')
# return best model
best = compare_models()
# return best model based on Recall
@nhymxu
nhymxu / README-python-framework-benchmark.md
Last active July 3, 2024 12:28
Flask vs Falcon vs FastAPI benchmark
gunicorn run:app --workers=9
gunicorn run:app --workers=9 --worker-class=meinheld.gmeinheld.MeinheldWorker

Macbook Pro 2015 Python 3.7

Framework Server Req/s Max latency +/- Stdev
@rvaidya
rvaidya / database_to_parquet.py
Last active September 17, 2024 02:38
Dump database table to parquet file using sqlalchemy and fastparquet. Useful for loading large tables into pandas / Dask, since read_sql_table will hammer the server with queries if the # of partitions/chunks is high. Using this you write a temp parquet file, then use read_parquet to get the data into a DataFrame
import pandas as pd
import numpy as np
import fastparquet
from sqlalchemy import create_engine, schema, Table
# Copied from pandas with modifications
def __get_dtype(column, sqltype):
import sqlalchemy.dialects as sqld
@Valian
Valian / arbitrage.py
Created January 18, 2018 23:33
Short script for finding Binance Triangle arbitrage opportunities - requires python-binance installed
from collections import defaultdict
from operator import itemgetter
from time import time
from binance.client import Client
FEE = 0.0005
PRIMARY = ['ETH', 'USDT', 'BTC', 'BNB']
@jh00nbr
jh00nbr / cpf_consulta_api_sus.py
Last active May 17, 2023 17:36
Script simples para consulta de dados na base dados nacional do SUS utilizando o CPF.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests,json,sys
# Script simples para consulta de dados na base dados nacional do SUS utilizando o CPF.
# Jhonathan Davi A.K.A jh00nbr / Insightl4b lab.insightsecurity.com.br
# jh00nbr: http://jhonathandavi.com.br
# Blog: lab.insightsecurity.com.br
# Github: github.com/jh00nbr
# Twitter @jh00nbr
@devStepsize
devStepsize / slack_webhook_post.py
Last active November 6, 2024 07:10
POST a JSON payload to a Slack Incoming Webhook using Python requests
'''
This is an example of how to send data to Slack webhooks in Python with the
requests module.
Detailed documentation of Slack Incoming Webhooks:
https://api.slack.com/incoming-webhooks
'''
import json
import requests
from flask import Flask, render_template, request
import os , shelve , atexit , threading , urllib2 , time
app = Flask(__name__)
poll_data = {
'question' : 'You agree that the Brazilian internet should be stapled?',
'fields': ['Yes', 'No']
}
db = shelve.open("votes.db",writeback=True)
@paulohrpinheiro
paulohrpinheiro / 000_novice-problem.py
Last active December 28, 2016 17:43
Primeira lista de exercícios do Test Driven Learning - 000_novice-python3
"""
Test Driven Learning Project.
Desenvolva TDD e programação com TDD e programação!
Módulo novice.
The MIT License (MIT)
Copyright (c) 2016 Paulo Henrique Rodrigues Pinheiro <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EricsonWillians
EricsonWillians / luciano_silva_simulator.py
Created October 18, 2015 17:03
A Luciano Silva Simulator implemented in Python 3.x.
# -*- coding: utf-8 -*-
#
# luciano_silva_simulator.py
#
# Copyright 2015 Ericson Willians (Rederick Deathwill) <EricsonWRP@ERICSONWRP-PC>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.