This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Action": [ | |
| "logs:CreateLogGroup", | |
| "logs:CreateLogStream", | |
| "logs:PutLogEvents" | |
| ], | |
| "Resource": "arn:aws:logs:*:*:*", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Action": [ | |
| "es:ESHttpDelete", | |
| "es:ESHttpGet", | |
| "es:ESHttpHead", | |
| "es:ESHttpPost", | |
| "es:ESHttpPut" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from chalice import Chalice | |
| from boto.connection import AWSAuthConnection | |
| class ESConnection(AWSAuthConnection): | |
| def __init__(self, region, **kwargs): | |
| super(ESConnection, self).__init__(**kwargs) | |
| self._set_auth_region_name(region) | |
| self._set_auth_service_name('es') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="https://gist.github.com/hatdropper1977/a8d9cddb02b0eb6bc074.js"></script> | |
| {% extends "bootstrap/base.html" %} | |
| {% import "bootstrap/wtf.html" as wtf %} | |
| {% block content %} | |
| <div class="container"> | |
| <h3>Please answer this very important essay</h3> | |
| <p>If you don't it'll go on your permanent record!.</p> | |
| <hr> | |
| {{ wtf.quick_form(form) }} | |
| <hr> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!bin/python | |
| from flask import Flask, render_template, request | |
| from flask_bootstrap import Bootstrap | |
| from models import QuizForm | |
| class Config(object): | |
| SECRET_KEY = '78w0o5tuuGex5Ktk8VvVDF9Pw3jv1MVE' | |
| application = Flask(__name__) | |
| application.config.from_object(Config) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask_wtf import Form | |
| from wtforms import TextField, SubmitField, TextAreaField | |
| from wtforms.validators import Length, Email, Required | |
| # Form ORM | |
| class QuizForm(Form): | |
| essay_question = TextAreaField('Who do you think won the console wars of 1991, Sega Genesis or Super Nintendo? (2048 characters)', validators=[Required(),Length(max=2047)] ) | |
| email_addr = TextField('Enter Your Email', validators=[Required(), Email()]) | |
| submit = SubmitField('Submit') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from xml.dom import minidom | |
| from xml.etree.ElementTree import Element, SubElement, Comment, tostring | |
| import xml.etree.ElementTree as ET | |
| class Edge(Element): | |
| def __init__(self): | |
| # Create the schema | |
| Element.__init__(self,'edge') | |
| self.append(Element('name')) | |
| self.append(Element('datacenterMoid')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # application.py | |
| from boto.connection import AWSAuthConnection | |
| from flask import Flask, render_template, request, redirect, url_for, flash | |
| from models import Quiz, QuizForm | |
| from datetime import datetime | |
| from config import DevConfig | |
| import json | |
| from flask_bootstrap import Bootstrap | |
| ### BEGIN CELERY |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # tasks.py | |
| from boto.connection import AWSAuthConnection | |
| import requests | |
| from celery import Celery | |
| # Be sure to add your SQS URL below! | |
| application = Celery('tasks',broker='sqs://sqs.us-east-1.amazonaws.com/<your arn>/flask-es') | |
| class ESConnection(AWSAuthConnection): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # geo_check.py | |
| from boto.connection import AWSAuthConnection | |
| class ESConnection(AWSAuthConnection): | |
| def __init__(self, region, **kwargs): | |
| super(ESConnection, self).__init__(**kwargs) | |
| self._set_auth_region_name(region) | |
| self._set_auth_service_name("es") |
NewerOlder