Skip to content

Instantly share code, notes, and snippets.

version: 0.2
env:
variables:
GO_VERSION: 1.9.2
SRC_DIR: src/github.com/manabusakai/aws-billing
phases:
install:
commands:
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active May 22, 2024 13:44
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
@Forever-Young
Forever-Young / gist:70479b8bdc8a96f6bf4851b41ff65c3e
Created February 25, 2017 21:45
Cascading fields example
ModelView
---------
# field1 (->Model1), field2 (->Model2) filtered by field1 values
column_filter_by = ('field2')
form_widget_args = {
'field2': {
'data-filter-by': 'field1',
}
}
// export a configuration from a source GTM container and merge import it with a target GTM container
// from: https://developers.google.com/tag-manager/api/v1/
// Get the published version of the source container
// GET https://www.googleapis.com/tagmanager/v1/accounts/{{accountId}}/containers/{{containerId}}/versions/published
source = tagmanager.accounts().containers().versions().get(
accountId='123456',
containerId='54321',
containerVersionId='2'
).execute()
@chenzhan
chenzhan / redshift_admin_queries.sql
Last active August 8, 2023 05:49
Redshift Tips
# List all tables:
select db_id, id, name, sum(rows) as mysum
from stv_tbl_perm where db_id = 100546
group by db_id, id, name order by mysum desc;
# list all running processes:
select pid, query from stv_recents where status = 'Running';
# describe table
select * from PG_TABLE_DEF where tablename='audit_trail';
@ysaotome
ysaotome / install_pyenv.sh
Last active August 7, 2021 13:27
pyenv install for CentOS 6.5 x86_64
#!/bin/zsh
# pyenv install for CentOS 6.5 x86_64
yum install -y gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite-devel bzip2-devel
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
@mrjoes
mrjoes / test.py
Created May 5, 2013 17:49
How to customize options in QuerySelectField. High level idea: 1. Hook `create_form` to change options when creating model and `edit_form` when editing model 2. Provide different `query_factory` for the field 3. Do filtering/population logic in the _get_parent_list Alternatively: 1. Can hook `scaffold_form` and change `form.parent.kwargs['query_…
from flask import Flask, request, url_for
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.admin.contrib import sqlamodel
from flask.ext import admin
# Create application
app = Flask(__name__)
# Create dummy secrey key so we can use sessions