Skip to content

Instantly share code, notes, and snippets.

View antstanley's full-sized avatar
🐶
On the internet, nobody knows you're a hooman.

Ant Stanley antstanley

🐶
On the internet, nobody knows you're a hooman.
View GitHub Profile
@antstanley
antstanley / development_guidelines.md
Created April 24, 2026 05:34
Development Guidelines

08 — Development Guidelines

These are the rules of the road for everyone (humans and agents) writing code in this repository. They are deliberately tight; if a guideline doesn't fit a situation, the answer is to discuss and amend the guideline rather than ignore it.


Toolchain

Tool Version / channel Notes
@antstanley
antstanley / setup_devbox.sh
Last active April 7, 2026 09:39
Setup an Amazon Linux 2023 box to run Claude Code for development (works with x86_64 and aarch64)
sudo dnf update
# Setup ZSH
sudo dnf install -y git
sudo dnf install -y zsh
sudo dnf install -y util-linux-user
sudo chsh -s $(which zsh) $(whoami)
wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
CHSH=yes zsh install.sh
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
@antstanley
antstanley / bundle.sh
Last active January 16, 2025 14:21
Run SvelteKit in AWS Lambda - cdk stack, bundle script and SvelteKit config. Uses SvelteKit's Node.js adapter and Lambda Web Adapter
#! /bin/bash
# - Clear out the dist folder
# - Create new empty folder called svelteKit that will be bundled
# - Run 'vite build' to create production bundle
# - Create run.sh file to be invoked by Lambda using the Lambda Web Adapter
# - Change permissions on newly create run.sh file to allow execution
# - Create package.json file with { "type": "module" } property to ensure all js files use ESM
rm -rf dist
@antstanley
antstanley / avgHoursCompare.sql
Created November 21, 2024 12:26
SQL Statement to Compare Average Hours worked per country across 1990s, 2000's, and 2010's
SELECT "2000s".Entity, "1990s".AvgHours as "1990 - 1999", "2000s".AvgHours as "2000 - 2009", "2010s".AvgHours as "2010 - 2019" FROM (SELECT Entity, AVG("Average annual working hours per worker") AS AvgHours FROM read_csv_auto('https://ourworldindata.org/grapher/annual-working-hours-per-worker.csv?v=1&csvType=full&useColumnShortNames=true') WHERE Year BETWEEN 2010 AND 2019 GROUP BY "Entity") AS "2010s" INNER JOIN (SELECT Entity, AVG("Average annual working hours per worker") AS AvgHours FROM read_csv_auto('https://ourworldindata.org/grapher/annual-working-hours-per-worker.csv?v=1&csvType=full&useColumnShortNames=true') WHERE Year BETWEEN 2000 AND 2009 GROUP BY "Entity") AS "2000s" ON "2000s".Entity = "2010s".Entity INNER JOIN (SELECT Entity, AVG("Average annual working hours per worker") AS AvgHours FROM read_csv_auto('https://ourworldindata.org/grapher/annual-working-hours-per-worker.csv?v=1&csvType=full&useColumnShortNames=true') WHERE Year BETWEEN 1990 AND 1999 GROUP BY "Entity") AS "1990s" ON "1990s".Enti
@antstanley
antstanley / index.js
Created May 31, 2024 14:26
Why use 27 lines when you can use 8
import { BedrockRuntimeClient, ConverseCommand } from "@aws-sdk/client-bedrock-runtime";
console.log((await new BedrockRuntimeClient({ region: 'us-east-1' }).send(new ConverseCommand({
modelId: "anthropic.claude-3-haiku-20240307-v1:0", messages: [{
role: "user",
content: [{ text: "Explain 'rubber duck debugging' in one line." }],
}]
}))).output.message.content[0].text)
@antstanley
antstanley / mimeTypes.json
Created May 7, 2024 10:11
JSON dictionary of file extensions and their corresponding mime types
{
"./aac": "audio/aac",
".abw": "application/x-abiword",
".apng": "image/apng",
".arc": "application/x-freearc",
".avif": "image/avif",
".avi": "video/x-msvideo",
".azw": "application/vnd.amazon.ebook",
".bin": "application/octet-stream",
".bmp": "image/bmp",
@antstanley
antstanley / cors.json
Created October 5, 2022 23:55
Example of CORS headers for API Gateway with Authorization and Cookies
{
"Access-Control-Allow-Headers":
"Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token, Access-Control-Allow-Origin, Access-Control-Allow-Methods, Access-Control-Allow-Credentials, Cookie, Set-Cookie",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "POST, OPTIONS, GET",
"Access-Control-Allow-Credentials": true
}
@antstanley
antstanley / .env
Created September 9, 2021 00:33
Get Cognito User Token
COGNITO_CLIENT_ID=<cognito client id>
COGNITO_USER_POOL_ID=<cognito user pool id>
COGNITO_USERNAME=<cognito username>
COGNITO_PASSWORD=<cognito user password>
@antstanley
antstanley / buildUpdateParams.js
Created February 16, 2021 11:05
Dynamically build update parameters required for the DynamoDB Client. Just pass a JSON object of the fields you want to update and get the UpdateExpression, ExpressionAttributeNames and ExpressionAttributeValues returned.
function mapToObject (processMap) {
const returnObject = {}
for (const [key, value] of processMap) {
returnObject[key] = value
}
return returnObject
}
function randomString (stringLength) {
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'
@antstanley
antstanley / index.js
Created April 11, 2019 14:09
Google Run test code with file system layout
const express = require('express')
const fs = require('fs')
const path = require('path')
const app = express()
let coldstart = true
const fsExplore = async dir => {
try {
const dirContents = fs.readdirSync(dir, {