boto3 # aws sdk
requests # to download dynamodb
mirakuru # monitors the subprocess and checks for an open port
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
"""Bridge between arcade and imgui using arcade.gl for rendering. | |
Works with arcade 3.0.0.dev32 and imgui 2.0.0. | |
Requires "imgui[pyglet]". | |
Documentation for imgui usage can be found here | |
https://pyimgui.readthedocs.io/en/latest/index.html |
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 threading import Thread | |
import pytest | |
import requests | |
from flask import Flask | |
@pytest.fixture() | |
def app() -> Flask: | |
host = 'localhost' |
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 flask import Flask | |
from flask.json import JSONEncoder | |
class EnhancedJSONEncoder(JSONEncoder): | |
def default(self, o): | |
if dataclasses.is_dataclass(o): | |
return dataclasses.asdict(o) | |
return super().default(o) |
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
# Timer for functions | |
from functools import wraps | |
def timeit(f): | |
@wraps(f) | |
def wrap(*args, **kwargs): | |
start = time() | |
r = f(*args, **kwargs) | |
print(f.__name__, time() - start) |
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
#!/usr/bin/env bash | |
# put into .profile.d/ | |
LICENSE_KEY=$(echo $VCAP_SERVICES | jq -r '.[] | select(.[].name | contains("newrelic"))| .[0].credentials.licenseKey') | |
if test -z "$LICENSE_KEY" | |
then | |
echo "INFO: No New Relic service bound to app" | |
else | |
echo "INFO: New Relic service found" |
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 secrets | |
from typing import Union | |
from flask import Flask, Blueprint, Response, request | |
class BasicAuth: | |
def __init__(self, app: Union[Flask, Blueprint], username: str, password: str): | |
self.app = app | |
self.username = username |
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 math | |
from typing import List | |
import arcade | |
class Block: | |
def __init__(self, x: float, y: float, r: float): | |
self.x = x | |
self.y = y |
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
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css"> | |
<title>Lob.com Sample 4x6 Postcard Back</title> | |
<style> | |
*, *:before, *:after { | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
box-sizing: border-box; |
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
#!/usr/bin/env bash | |
function load_service_credentials { | |
service_name=$1 | |
# Read credentials for queue | |
SERVICE_KEY_JSON=$(cf service-key $service_name key | grep -v "Getting") | |
export AWS_ACCESS_KEY_ID=$(echo ${SERVICE_KEY_JSON} | jq '.access_key' -r) | |
export AWS_SECRET_ACCESS_KEY=$(echo ${SERVICE_KEY_JSON} | jq '.secret_access_key' -r) | |
export AWS_DEFAULT_REGION=$(echo ${SERVICE_KEY_JSON} | jq '.region' -r) | |
export AWS_URI=$(echo ${SERVICE_KEY_JSON} | jq '.uri' -r) |
NewerOlder