A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
--- | |
version: 1 | |
disable_existing_loggers: False | |
formatters: | |
simple: | |
format: "%(name)-20s%(levelname)-8s%(message)s" | |
handlers: | |
console: | |
class: logging.StreamHandler | |
level: DEBUG |
import boto3 | |
from boto3.dynamodb.types import STRING | |
table = boto3.resource("dynamodb", region_name="us-east-1").Table("availdev-JobStateDB-1UIJ881212TPX") | |
## Attrs for GSI | |
attrdef = [ | |
{"AttributeName": "state", "AttributeType": STRING}, | |
{"AttributeName": "userId", "AttributeType": STRING}, | |
{"AttributeName": "assetId", "AttributeType": STRING} |
This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out : https://docs.microsoft.com/azure/azure-cache-for-redis/cache-best-practices.
Simply put, a keyspace "MISS" means some piece of data you tried to retrieve from Redis was not there. This usually means that one of the following things happened:
#! /usr/bin/env python | |
############################################################### | |
# In your .bashrc/.zshrc add `eval $(python <path to script>)` | |
# Or simply run `eval $(python <path to script>)` | |
# This avoids adding your aws credentials to bash/zsh history | |
############################################################### | |
import os, sys | |
from ConfigParser import ConfigParser |
#!/usr/bin/env python | |
import argparse | |
import redis | |
def connect_redis(conn_dict): | |
conn = redis.StrictRedis(host=conn_dict['host'], | |
port=conn_dict['port'], | |
db=conn_dict['db']) | |
return conn |
/* Pre-requisite | |
================== | |
1) Create an Environment (if you don't already have on) and enable it for your request | |
2) Add a new Header with key as "Authorization" and value as "{{hmacAuthHeader}}" | |
3) Add the following Pre-request Script that computes the hmacAuthHeader variable and adds it to the environment | |
4) Fill your CLIENT_KEY and SECRET_KEY with valid values | |
*/ | |
function getPath(url) { | |
var pathRegex = /.+?\:\/\/.+?(\/.+?)(?:#|\?|$)/; |