Skip to content

Instantly share code, notes, and snippets.

@rafaeljesus
rafaeljesus / k8s-cluster-module.tf
Last active December 1, 2020 07:03
k8s cluster creation terraform
module "vpc" {
source = "git::git@github.com:rafaeljesus/vpc?ref=master"
vpc_id = var.vpc_id
vpc_cidr_block = var.vpc_cidr_block
azs = slice(data.aws_availability_zones.available.names, 0, 3)
public_subnets = var.vpc_public_subnets
private_subnets = var.vpc_private_subnets
igw_id = var.vpc_igw_id
@bluekvirus
bluekvirus / flask-uWSGI-nginx.md
Last active July 19, 2022 20:26
How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 14.04+

How To Serve Flask Applications with uWSGI and Nginx on Ubuntu 14.04

@credit Yan Zhu (https://github.com/nina-zhu)

Introduction

Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions, it can help you get your Python application or website off the ground. Flask includes a simplified development server for testing your code locally, but for anything even slightly production related, a more secure and powerful web server is required.

In this guide, we will demonstrate how to install and configure some components on Ubuntu 14.04 to support and serve Flask applications. We will configure the uWSGI application container server to interface with our applications. We will then set up Nginx to reverse proxy to uWSGI, giving us access to its security and performance features to serve our apps.

Prerequisites and Goals

@jrus
jrus / lua-uuid.lua
Created July 29, 2012 09:26
quick lua implementation of "random" UUID
local random = math.random
local function uuid()
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)
end)
end