Skip to content

Instantly share code, notes, and snippets.

View jeffmylife's full-sized avatar
🌊
back to learning

Jeffrey Lemoine jeffmylife

🌊
back to learning
View GitHub Profile
@jeffmylife
jeffmylife / colorized_voronoi.py
Last active June 25, 2019 18:46 — forked from pv/colorized_voronoi.py
Colorized Voronoi diagram with Scipy, in 2D, including infinite regions
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Voronoi
def voronoi_finite_polygons_2d(vor, radius=None):
"""
Reconstruct infinite voronoi regions in a 2D diagram to finite
regions.
Parameters
@jeffmylife
jeffmylife / s3_multipart_upload.py
Last active October 21, 2022 22:19 — forked from teasherm/s3_multipart_upload.py
S3 Multipart Upload from request.file
'''
See comments for description & usage instructions.
'''
import boto3, botocore
from .config import S3_KEY, S3_SECRET, S3_BUCKET, S3_LOCATION
def get_file_size(file):
file.seek(0, os.SEEK_END)
@jeffmylife
jeffmylife / aws_fargate_docker_application_load_balancer_without_public_ip.md
Last active September 25, 2020 19:22 — forked from jonashaag/aws_fargate_docker_application_load_balancer_without_public_ip.md
AWS Fargate Docker Application Load Balancer How to (without public IP)

AWS Fargate Docker Simple Deployment Setup with SSL termination

How to:

  • create a Docker-based AWS Fargate/ECS deployment
  • without the Docker containers having a public IP
  • with an Application Load Balancer as reverse proxy / SSL termination proxy sitting in front of the containers

For Fargate/ECS to be able to access your Docker images hosted on ECR (or somewhere else) you'll have to allow outbound internet access to the Fargate subnets. Here's how you do it.

@jeffmylife
jeffmylife / DynamoSession.py
Created October 1, 2020 23:29 — forked from awesomebjt/DynamoSession.py
Store your Flask sessions in DynamoDB - Python 3.5
from uuid import uuid4
from datetime import datetime, timedelta
from flask.sessions import SessionInterface, SessionMixin
from werkzeug.datastructures import CallbackDict
import boto3
class DynamoSession(CallbackDict, SessionMixin):
def __init__(self, initial=None, sid=None):
CallbackDict.__init__(self, initial)