Skip to content

Instantly share code, notes, and snippets.

Avatar
💚
You are now aware that you are breathing

Brian LeRoux brianleroux

💚
You are now aware that you are breathing
View GitHub Profile
View chatgpt.txt
In the year 2256, the San Francisco Bay Area Rapid Transit system, known simply as the SF BART, was still a vital part of daily life in the bustling city. Despite the many societal upheavals and wars that had threatened to destroy it, the SF BART had managed to survive and thrive, providing reliable transportation to millions of inhabitants.
The key to the SF BART's success was its adaptability and resilience. When a massive earthquake devastated San Francisco in the early 22nd century, the BART system was able to quickly repair and rebuild, thanks in part to its strong infrastructure and robust emergency protocols. When the city faced a major food shortage, the BART's efficient transportation network allowed for the swift distribution of resources, ensuring that no one went hungry.
But the SF BART's greatest challenge came during the Romulan War. As the war raged on, the city of San Francisco was subjected to numerous bombing raids and ground assaults. The SF BART faced significant damage, but the dedicate
@brianleroux
brianleroux / logs.txt
Created November 16, 2022 23:47
quick test of lambda layer w Deno runtime
View logs.txt
Nov 16th 2022, 03:46:08 PM
REPORT RequestId: f949935c-0f0e-4718-9976-9df42585adb5 Duration: 2.05 ms Billed Duration: 3 ms Memory Size: 1152 MB Max Memory Used: 76 MB
Nov 16th 2022, 03:46:04 PM
REPORT RequestId: 89ba7dfa-72d1-4ad7-9dac-2214d1698697 Duration: 4.42 ms Billed Duration: 338 ms Memory Size: 1152 MB Max Memory Used: 75 MB Init Duration: 333.05 ms
@brianleroux
brianleroux / plugin.js
Created July 28, 2022 19:09
make api gateway send back rest api style req/res
View plugin.js
/**
* this incantation will set the HttpApi response payload
* format to 1.0 which enables multiple headers
* https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html#http-api-develop-integrations-lambda.response
*/
module.exports = {
deploy: {
async start ({ arc, cloudformation }) {
if (!arc) console.log('missing arc')
let base = cloudformation.Resources.HTTP.Properties.DefinitionBody.paths['/']
@brianleroux
brianleroux / fun.js
Created June 14, 2022 16:22
example of runtime resource discovery built into architect
View fun.js
import arc from '@architect/functions'
// send an event to the SNS topic named 'ping'
// … under the hood the ARN is arn:aws:sns:us-west-2:818138539153:appname-ping-Q1C4HOR7RT2H:6bd207a6-4aaf-4015-bad4-a30adf7944f
await arc.events.publish({
name: 'ping',
payload: { pingID: Date.now() }
})
// read from the db table named 'pings'
View aws.cjs
let aws = require('aws-sdk')
module.exports = {
CloudFormation: aws.CloudFormation,
ApiGatewayV2: aws.ApiGatewayV2,
ACM: aws.ACM,
Route53: aws.Route53,
}
View output.txt
> @architect/architect@9.5.1 test:unit
> cross-env tape 'test/unit/**/*-test.js'
TAP version 13
# Core Architect packages and necessary CLI interfaces are present
ok 1 create found
ok 2 create CLI found
ok 3 deploy found
ok 4 deploy CLI found
@brianleroux
brianleroux / .arc-config
Created September 15, 2020 21:35
examle .arc-config with multiple policies
View .arc-config
@aws
runtime python3.7
memory 256
timeout 3
concurrency 1
policies
arn:aws:iam::aws:policy/AmazonDynamoDBReadOnlyAccess
arn:aws:iam::aws:policy/AWSAccountActivityAccess
View sam-ws-fun.json
{
"AWSTemplateFormatVersion": "2010-09-09",
"Transform": "AWS::Serverless-2016-10-31",
"Description": "Exported by architect/package@2.0.0-RC.0 on 2020-07-13T17:10:57.465Z",
"Resources": {
"HTTP": {
"Type": "AWS::Serverless::HttpApi",
"Properties": {
"StageName": "$default",
"DefinitionBody": {
View foo.js
// sign up save the data by creating a dynamic index..
await begin.set([
{table: `users`, key: userID, email, name, etc},
{table: `user-${ email }`, key: userID, email, name, etc}
])
@brianleroux
brianleroux / .arc-env
Created March 23, 2020 17:55
working local with env vars
View .arc-env
# ensure this file is in your .gitignore
# example .arc-env
@testing
MYVAR asdfasdf
MYVAR2 blah
@staging
MYVAR val
MYVAR2 foo