Skip to content

Instantly share code, notes, and snippets.

View mpurdon's full-sized avatar

Matthew Purdon mpurdon

View GitHub Profile
@mpurdon
mpurdon / challenge.ts
Created January 24, 2025 13:25
Code Review Challenge
import express, { Request, Response } from 'express';
import bodyParser from 'body-parser';
const app = express();
app.use(bodyParser.json());
interface Book {
title: string;
author: string;
isbn: string;
Ref: http://stackoverflow.com/questions/15185661/update-openssl-on-os-x-with-homebrew
```
1. Make sure openssl is installed via homebrew
homebrew install openssl
2. if /usr/local/bin is not already the first item in the $PATH, modify the PATH variable
set -gx PATH /user/local/bin $PATH
3. Make symlink to the binary
@mpurdon
mpurdon / genconfig.sh
Created August 9, 2024 04:42
Generate a pyrightconfig.json file
jq \
--null-input \
--arg venv "$(basename $(poetry env info -p))" \
--arg venvPath "$(dirname $(poetry env info -p))" \
'{ "venv": $venv, "venvPath": $venvPath }' \
> pyrightconfig.json
@mpurdon
mpurdon / $HOME:.oh-my-zsh:custom:nvm.zsh
Last active May 25, 2024 20:35
NVM oh-my-zsh script
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PATH=$PATH:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export PATH=$PATH:$(npm get prefix)/bin
find-up() {
path=$(pwd)
while [[ "$path" != "" && ! -e "$path/$1" ]]; do
path=${path%/*}
@mpurdon
mpurdon / obsidian-note.md
Created December 8, 2023 15:19
ChatGPT Instructions - Output for Obsidian

What would you like ChatGPT to know about you to provide better responses?

Obsidian Note Formatting

Folders:

- Capture: Initial thoughts.
- Process: Refining info.
- Organize: Structured notes.
@mpurdon
mpurdon / user-stories.md
Created December 8, 2023 15:15
ChatGPT Instructions - User stories

What would you like ChatGPT to know about you to provide better responses?

Consider that this task is meant for an audience of software engineers so focus on technical details

How would you like ChatGPT to respond?

@mpurdon
mpurdon / general-programming.md
Created December 8, 2023 15:14
ChatGPT Instructions - General programming question

What would you like ChatGPT to know about you to provide better responses?

I would like production-ready solutions with logging and error handling.

I want to follow best practices using the latest features of languages and frameworks. Specify types for everything and do not use "any" anywhere in the solution

I want the code to be clean and functional in nature, with discreet code extracted into functions so that try/catch blocks can focus on specific error scenarios 
@mpurdon
mpurdon / aws-lambda.md
Created December 8, 2023 15:13
ChatGPT Custom Instructions - AWS Lambda Generation

What would you like ChatGPT to know about you to provide better responses?

I am a software architect that works in a serverless environment using AWS.

I want solutions to specifically focus on a lambda function for problem asked, do not try to implement infrastructure or other artifacts as part of the solution

I would like production-ready solutions with logging and error handling as well as metrics and tracing using the `@aws-lambda-powertools` library. Always use the AWS SDK version 3 library. 

I want to follow best practices using the latest features of languages and frameworks. Specify types for everything and do not use the "any" type anywhere in the solution
@mpurdon
mpurdon / index.ts
Created August 16, 2023 17:08
Convert a DynamoDB backup to Excel
import {S3Client, ListObjectsV2Command, GetObjectCommand} from '@aws-sdk/client-s3';
import {Workbook, Worksheet, Border} from 'exceljs';
import {createGunzip} from 'zlib';
import {Readable} from 'stream';
// Configuring the AWS environment
const s3Client = new S3Client({region: 'us-east-1'});
async function listJsonFiles(bucketName: string, prefix: string): Promise<string[]> {
console.log({
@mpurdon
mpurdon / 0001-use-conventional-commits.md
Last active August 10, 2023 16:16
First proposal for an evolution

Use Conventional Commits for Commit Messages

Introduction