This file contains 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 main import __hug_wsgi__ as application |
This file contains 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
# Create a new virtualenv using the last component of path name | |
# Activate immediately when created | |
function pyenv_easy_3() { | |
result=${PWD##*/} | |
printf 'Create virtualenv for named local path...' | |
printf '%s\n' $result | |
pyenv virtualenv 3.6.1 $result | |
printf 'Setting local to new virtualenv...\n' | |
pyenv local $result |
This file contains 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 requests | |
from time import sleep | |
import os | |
import asyncio | |
import aiohttp | |
async def submit_and_wait(): | |
print('Submitting request') | |
request_url = '<base url>/create_request' |
This file contains 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
# create new profile, prior step | |
# aws configure --profile=name123 | |
# use profile with tools | |
alias aws_name123='export AWS_PROFILE=name123' |
This file contains 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 collections import defaultdict | |
@app.cli.command("list_routes") | |
def list_routes(): | |
""" | |
Roll through Flask's URL rules and print them out | |
Thank you to Jonathan Tushman | |
And Thank you to Roger Pence | |
Sourced http://flask.pocoo.org/snippets/117/ "Helper to list routes (like Rail's rake routes)" |
This file contains 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
# http://flask.pocoo.org/docs/0.12/patterns/apierrors/ | |
from flask import jsonify | |
class InvalidUsage(Exception): | |
status_code = 400 | |
def __init__(self, message, status_code=None, payload=None): | |
Exception.__init__(self) |
This file contains 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 sys | |
sys.path.append("../") # go to parent dir | |
from customFunctions import * | |
# Then, to affect changes in customFunctions.py, | |
%load_ext autoreload | |
%autoreload 2 | |
#ref: https://stackoverflow.com/a/42727538/23991 |
This file contains 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 builtins | |
import pytest | |
from io import StringIO | |
import yaml | |
TEST_CONFIG = """ | |
environment: prod | |
""" | |
This file contains 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 importlib import import_module | |
from importlib import resources | |
PLUGINS = dict() | |
def register_plugin(func): | |
"""Decorator to register plug-ins""" | |
name = func.__name__ | |
PLUGINS[name] = func | |
return func |
This file contains 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
# Python 3 + VirtualEnv + HighSierra + Pygame 1.9.x (Dev-Dec21) + Xcode 10.1 + Homebrew | |
# https://www.pygame.org/wiki/MacCompile | |
# 1. Install <a href="https://brew.sh">Homebrew</a> -- instructions found here. | |
# 2. Install XQuartz: | |
brew install Caskroom/cask/xquartz | |
# 3. Install Python 3.7.x | |
brew install python3 |
OlderNewer