This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"./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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COGNITO_CLIENT_ID=<cognito client id> | |
COGNITO_USER_POOL_ID=<cognito user pool id> | |
COGNITO_USERNAME=<cognito username> | |
COGNITO_PASSWORD=<cognito user password> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mapToObject (processMap) { | |
const returnObject = {} | |
for (const [key, value] of processMap) { | |
returnObject[key] = value | |
} | |
return returnObject | |
} | |
function randomString (stringLength) { | |
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Purgecss = require('purgecss') | |
const { JSDOM } = require('jsdom') | |
const CleanCSS = require("clean-css"); | |
//array of css files to combine | |
const cssFiles = ['./src/css/custom.css','./src/css/markdown.css', './src/css/tachyons.css'] | |
// cleanCSSOptions for minification and inlining css, will fix duplicate media queries | |
const cleanCSSOptions = { | |
level: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const uuid = require("uuid").v4; | |
const topicCreds = "mytopickey"; | |
const topicEndpoint = "mytopic.westeurope-1.eventgrid.azure.net"; | |
const request = require('request'); | |
function publishEvent(topicURL, topicSecret, eventPayload, callback) { | |
const options = { | |
method: 'POST', | |
url: topicURL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request'); | |
function publishEvent(topicURL, topicSecret, eventPayload, callback) { | |
const options = { | |
method: 'POST', | |
url: topicURL, | |
headers: { | |
'aeg-sas-key': topicSecret | |
}, |