Skip to content

Instantly share code, notes, and snippets.

View amancioandre's full-sized avatar
🤠
Life is what happens outdoors!

André Amnc amancioandre

🤠
Life is what happens outdoors!
View GitHub Profile
@amancioandre
amancioandre / .gitignore
Created June 10, 2020 18:47 — forked from GhostofGoes/.gitignore
Basic .gitignore template for Python projects
# Editors
.vscode/
.idea/
# Vagrant
.vagrant/
# Mac/OSX
.DS_Store
@amancioandre
amancioandre / send_data.py
Created June 5, 2020 17:07
Sending data to API from Pandas
import requests
import time
import pandas as pd
from json import dumps
headers = {
'Content-Type': 'application/json',
'Api-Key': 'api key here'
}
@amancioandre
amancioandre / setup.py
Created June 3, 2020 20:17
Python setup.py for package distribution
import io
import os
from pathlib import Path
from setuptools import find_packages, setup
from setuptools.command.install import install
from subprocess import call
# Package meta-data
NAME = 'your package name'
@amancioandre
amancioandre / requirements.txt
Last active June 3, 2020 20:16
Python Private Package Distribution
## Basic Instructions
# -------------------
# A package is on an open repository, follow the bellow example:
# Where:
# vcs = the provider [git+, hg+, svn+, bzr+]
# protocol = https or ssh
# egg = project name
# subdirectory = address to setup.py from the project root
-e vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir
@amancioandre
amancioandre / .gitignore
Created May 15, 2020 17:03
Machine Learning Engineering .gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
const first = new Promise((resolve, reject) => setTimeout(resolve, 5000));
const second = new Promise((resolve, reject) => setTimeout(reject, 5000));
Promise.allSettled([first, second]).then(myPromises => console.log(myPromises));
/*
[
{ status: 'fulfilled', value: undefined },
{ status: 'rejected', value: undefined },
]
@amancioandre
amancioandre / gist:5ca0ae905c7443f7ded356e8c949738c
Created April 29, 2020 23:46 — forked from skyuplam/gist:ffb1b5f12d7ad787f6e4
Flask-Security and Flask-Admin example by Steve Saporata
# Example of combining Flask-Security and Flask-Admin.
# by Steve Saporta
# April 15, 2014
#
# Uses Flask-Security to control access to the application, with "admin" and "end-user" roles.
# Uses Flask-Admin to provide an admin UI for the lists of users and roles.
# SQLAlchemy ORM, Flask-Mail and WTForms are used in supporting roles, as well.
from flask import Flask, render_template
from flask.ext.sqlalchemy import SQLAlchemy
@amancioandre
amancioandre / audit_mixin.py
Created April 18, 2020 01:02 — forked from techniq/audit_mixin.py
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
FROM python:3.7-alpine
WORKDIR /app
RUN apk update && apk upgrade
RUN apk add --no-cache make g++ bash git openssh postgresql-dev curl
RUN apk add --no-cache jpeg-dev zlib-dev
RUN apk add --no-cache gcc libc-dev fortify-headers linux-headers libxslt-dev
ENV PYTHONDONTWRITEBYTECODE 1
@amancioandre
amancioandre / captain-definition
Created March 26, 2020 15:50
Flask API Captain Definition
{
"schemaVersion": 2,
"dockerfilePath": "./Dockerfile"
}