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
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: Template for Lambda Sample. | |
| Outputs: | |
| LambdaRoleARN: | |
| Description: Role for Lambda execution. | |
| Value: | |
| Fn::GetAtt: | |
| - LambdaRole | |
| - Arn |
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
| #!/usr/bin/env bash | |
| export PYTHONPATH=`pwd` | |
| ./manage.py collectstatic --noinput | |
| echo Running ${1:-"update"} on ${2:-"local_zappa_settings.json"} | |
| zappa ${1:-"update"} -s ${2:-"local_zappa_settings.json"} | |
| zappa manage -s ${2:-"local_zappa_settings.json"} ${3:-"development"} migrate | |
| zappa invoke -s ${2:-"local_zappa_settings.json"} ${3:-"development"} "from django.contrib.auth.models import User; import os; User.objects.create_superuser('root', '[email protected]', os.environ.get('DJANGO_ADMIN_PASSWORD','*****')) if len(User.objects.filter(email='[email protected]')) == 0 else print('Admin exists')" --raw |
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
| sudo: required | |
| language: python | |
| python: | |
| - "3.6" | |
| services: | |
| - postgresql | |
| addons: | |
| postgresql: "9.6" | |
| cache: | |
| - pip |
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
| fail_fast: true | |
| repos: | |
| - repo: https://github.com/ambv/black | |
| rev: 18.6b4 | |
| hooks: | |
| - id: black | |
| language_version: python3.6 | |
| - repo: https://github.com/pre-commit/mirrors-mypy | |
| rev: v0.610-1 |
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
| scheduler = Scheduler("bucket", "/path", s3_resource, s3_client) | |
| time = nowut() + timedelta(minutes=10) | |
| key = scheduler.schedule(time, "s3-bucket", "s3_files-important", "content") | |
| scheduler.stop(key) |
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
| import boto3 | |
| from s3_scheduler.scheduler import Scheduler | |
| from s3_scheduler.utils import nowut | |
| s3_resource = boto3.resource("s3") | |
| s3_client = boto3.client("s3") | |
| scheduler = Scheduler("bucket", "/path", s3_resource, s3_client) | |
| time = nowut() + timedelta(minutes=10) | |
| upload_to = scheduler.schedule(time, "s3-bucket", "s3_files-important", "content") |
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
| scheduler = Scheduler(...) | |
| def check_scheduled_events(): | |
| scheduler.handle() |
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
| #!/usr/bin/env bash | |
| set -e | |
| if [ -z "$1" ] | |
| then | |
| echo "Missing project name, please choose one..." | |
| firebase list | |
| exit 1 | |
| else | |
| if [ -z "${FIRESTORE_TOKEN}" ] |
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
| service cloud.firestore { | |
| match /databases/{database}/documents { | |
| // Allow user to read only his documents. No write allowed | |
| match /users/{user}/{document=**} { | |
| allow read: if request.auth != null && request.auth.uid == user | |
| } | |
| } | |
| } |
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 firebase_admin import auth | |
| from flask import request, abort, current_app | |
| from functools import wraps | |
| from configuration.settings import SHOULD_AUTHORIZE | |
| def validate_token(access_token: str) -> tuple: | |
| """ | |
| Verifies that an access-token is valid and |
NewerOlder