Skip to content

Instantly share code, notes, and snippets.

@jpwhite3
jpwhite3 / cognito-test.py
Created November 16, 2022 00:27 — forked from bgdnlp/cognito-test.py
Sign up and log in to Cognito, check tokens, then call an API. Details: https://www.neant.ro/aws/working-with-cognito-and-api-gateway-in-python.html
#!/usr/bin/env python3
# Demonstrates the use of Python to work with Cognito.
# Create a new a user, log in, check tokens and call an API.
# The purpose was to learn about Cognito. Security has been
# circumvented in the interest of keeping it simple.
# Notably, the authentication procedure uses the most insecure
# method. This code is not intended for use in production.
#
# https://www.neant.ro/aws/working-with-cognito-and-api-gateway-in-python.html
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jpwhite3
jpwhite3 / d20.py
Last active September 21, 2023 13:58
import unittest
import random
from typing import List
class D20:
minimum_value: int = 1
maximum_value: int = 20
number_range: List[int] = range(minimum_value, maximum_value + 1)
@jpwhite3
jpwhite3 / git-stats.md
Created September 13, 2021 03:03
Git Statistics

Coding Time

The time frame between ‘First Commit‘ to ‘PR Issued‘. It will show the average time it takes for a single engineering task (usually mapped to a branch) to go from First Commit to PR Issued.

Coding time is one of the most interesting engineering execution metrics to track over time. Since you want your PR Sizes to be small and your deployment frequency to be high, you want to make sure coding time isn’t increasing by a significant margin. If your coding time does spike, that is likely an indicator of larger issues down the pipeline.

Time to Merge

Time to merge refers to how long it takes for work to be merged, starting from the first commit.

@jpwhite3
jpwhite3 / rps.py
Created May 20, 2019 00:26
"Rock-Paper-Scissors" in Python
import random
CHOICES = 'rps'
def get_player_choice():
"""Get user input and validate it is one of the choices above"""
player_choice = None
while player_choice is None:
player_choice = input('Choices: \n(R)ock \n(P)aper \n(S)cissors \n\nPick: ')
from random import randint
class Character:
def __init__(self):
self.name = ""
self.health = 1
self.health_max = 1
def do_damage(self, enemy):
@jpwhite3
jpwhite3 / xrdp_fedora29.md
Last active June 4, 2024 22:37
How to configure XRDP on Fedora 29
@jpwhite3
jpwhite3 / dynamo_lock.py
Created April 23, 2018 05:11
Distributed Lock Manager using DynamoDB and Python
"""
Distributed Lock Manager using DynamoDB and Python
Inspired by: https://aws.amazon.com/blogs/database/building-distributed-locks-with-the-dynamodb-lock-client/
Written for Python 3.6 on macOS. Your milage may vary.
Requirements (pip install):
pynamdodb
pynamdodb[signals]
boto3
"""
import os

Keybase proof

I hereby claim:

  • I am jpwhite3 on github.
  • I am jpwhite3 (https://keybase.io/jpwhite3) on keybase.
  • I have a public key ASA_JH0RIVo-g6T4pSsko2fgjE57Lxcv1lzXJDasi5TSmgo

To claim this, I am signing this object: