Skip to content

Instantly share code, notes, and snippets.

View javamo's full-sized avatar

Jairo Vásquez javamo

  • Atlas Health
  • Medellin, Colombia
View GitHub Profile
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active April 10, 2024 16:40
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation
@iximiuz
iximiuz / flask_static_files_cache_invalidator.py
Last active October 28, 2019 18:56
Flask: add static file's cache invalidator param to URLs generated by url_for(). Blueprints aware.
""" Inspired by http://flask.pocoo.org/snippets/40/ """
app = Flask(__name__)
@app.url_defaults
def hashed_url_for_static_file(endpoint, values):
if 'static' == endpoint or endpoint.endswith('.static'):
filename = values.get('filename')
if filename:
if '.' in endpoint: # has higher priority
@jdiaz5513
jdiaz5513 / gae_remote_api_helper.py
Last active December 2, 2016 12:36
A script for Google App Engine remote_api shell that automatically creates a connection and drops you to the shell. I created this script for people who use the remote_api shell a lot; it saves me a lot of time. The best part is, it works with alternative Python shells like iPython!
#!/usr/bin/python2
"""
This script automates the task of connecting to a running App Engine server,
whether it's a local dev_appserver or a live app.
If PyQt4 is installed, it will ask for credentials inside a dialog box
instead of prompting in the terminal. This is good for shells that do
not support getpass (iPython).
It will automatically add an import path for a local virtualenv in the app
@erichiggins
erichiggins / appstats_serializer.py
Last active December 25, 2015 10:18
Protobuf to Python dictionary serializer for Google App Engine AppStats module.I wanted to be able to send my AppStats profile data off to a logging service (like Loggly) so that I could monitor it over time. This module serializes the data so that it can be converted to JSON and sent off to a log service by a cron job.
#!/usr/bin/env python
"""
AppStats serializer module which converts App Engine profile data from Protocol Buffers into JSON.
Usage:
import appstats_serializer
# List all AppStats summaries:
appstats_dicts = appstats_serializer.appstats_to_dict(summaries_only=True)
@kylefinley
kylefinley / gist:1059647
Created July 2, 2011 01:09
webapp2 auth User model
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
from ndb import model
from webapp2_extends.utils import Unique, UniqueConstraintViolation, \
check_password_hash, generate_password_hash
from webapp2_extends.auth import create_session_id
DEBUG = True