Skip to content

Instantly share code, notes, and snippets.

View fabiom91's full-sized avatar

Fabio Magarelli fabiom91

  • Dublin, IE
View GitHub Profile
@fabiom91
fabiom91 / gh-pandoc-LICENSE.md
Last active April 8, 2020 11:18 — forked from forivall/gh-pandoc-LICENSE.md
Github-style css for pandoc

The MIT License (MIT)

Copyright (c) 2016-2017 Emily M Klassen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

@fabiom91
fabiom91 / main.py
Created October 7, 2021 13:09
Minimal Flask Application
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"
@fabiom91
fabiom91 / main.py
Last active October 7, 2021 14:12
minimal flask app 2
from flask import Flask
import pandas as pd
app = Flask(__name__)
@app.route("/")
def hello_world():
mydata = {
"name":["John","Danny","Patricia","Rose"],
"office":["HR","Sales","Sales","HR"],
@fabiom91
fabiom91 / Dockerfile
Created October 7, 2021 13:43
Dockerfile Gunicorn flask
# Get image from docker hub
FROM tiangolo/meinheld-gunicorn-flask:python3.9
# If you need to install any apt package you can do it here e.g:
# RUN apt-get update && apt-get install -y pandoc
# Copy the requirements file into the container.
# The requirements file is a list of all pip packages we need.
COPY ./requirements.txt /app/requirements.txt
@fabiom91
fabiom91 / docker-compose.yml
Created October 7, 2021 13:45
docker-compose unicorn flask
version: "3"
services:
web:
build: .
ports:
- "80:80"
@fabiom91
fabiom91 / wsgi.py
Created October 7, 2021 13:48
wsgi Gunicorn flask
from main import app
if __name__ == "__main__":
app.run()
@fabiom91
fabiom91 / requirements.txt
Created October 19, 2021 11:29
DSLE Requirements
greenlet == 0.4.17
flask_cors == 3.0.10
flask == 2.0.2
pandas == 1.3.4
scikit-learn == 1.0
flask_sqlalchemy == 2.5.1
cherrypy == 18.6.1
paste == 3.5.0
@fabiom91
fabiom91 / pandas.py
Last active February 22, 2022 13:36
example split data
import pandas as pd
from sklearn.model_selection import train_test_split
# import my data into a dataframe (df)
df = pd.read_csv("mydata.csv")
# random split 60/40% solution / public dataframe
solution, public_df = train_test_split(df,test_size=0.40,random_state=101)