Skip to content

Instantly share code, notes, and snippets.

View kamauwashington's full-sized avatar

kamauwashington kamauwashington

View GitHub Profile
@kamauwashington
kamauwashington / luhn.py
Last active March 19, 2022 20:27
Simple Python Luhn / Mod 10 Algorithm, works with v3
import re
def luhn(input : str) -> bool :
if input is None :
return False
# keep it clean and pure to avoid failure, strip all non numeric characters from the input
workingInput : str = re.sub(r"[^\d]","",input)
@kamauwashington
kamauwashington / opensearch-search-request-logging.md
Last active April 14, 2022 17:16
AWS OpenSearch Search Request Logging

AWS OpenSearch Search Request Logging

There may be rules and regulations for logging in your production environment, please consult with your web engineering, or infrastructure equivalent prior to logging in this fashion to prevent unwanted charges and or side-effects.

This one took some time to figure out, and the AWS documentation Monitoring audit logs in Amazon OpenSearch Service did not point directly to how to log inbound REST search requests to OpenSearch to CloudWatch. There wasn't much on the web either in terms of discussions, or questions on the matter, so I hope this helps someone 😃

Steps

@kamauwashington
kamauwashington / aws-cdk-with-dotenv-and-typescript.md
Last active June 21, 2025 03:00
Using AWS CDK with dotenv and TypeScript (--require module implementation)

Using AWS CDK with dotenv and TypeScript

Note, I prefer the node --require option of loading .env variables over importing or requiring in application code.

TLDR;

  • install dotenv as a development dependency
  • in the cdk.json in the root of the project directory add the following in bold :
    • { "app": "npx ts-node -r dotenv/config --prefer-ts-exts bin/<stack-name>.ts" }

When developing via AWS CDK it is easy to set environment variables on resources as they are being defined to be stored in AWS. However, in some repositories there is a need to set environment variables for the CDK Stack to use.

@kamauwashington
kamauwashington / react-naming-conventions-simplified.md
Last active April 18, 2024 18:05
React Naming Conventions Simplified

Simple React Naming Conventions (anyone or any team can follow)

This is a list of best practices found not only in catalyst projects, but from years of web articles and personal practices that are easy to remember and implement across small or large React applications.

One of the most common discussions I have seen is which casing to use for what. The goal here is to keep it simple

A general Guideline (TLDR)

  • Pascal Case (MyComponent) for components, Classes, Interfaces
  • Kebab Case (my-component) for directories, non react components, and Function, Class, Interfaces file names