This file contains hidden or 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 { ConnectContactFlowEvent, Handler } from 'aws-lambda'; | |
import { invokeBedrock } from '../../commonUtils/bedrock'; | |
import { | |
submitServiceRequest, | |
getMeterAddress, | |
getMeterIssueId, | |
} from '../../commonUtils/311Api'; | |
interface ParkingMeterEvent { |
This file contains hidden or 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 cleanNotifications = () => { | |
// this can be updated to fix the bea | |
const notificationList = document.querySelector('div.scaffold-layout.scaffold-layout--sidebar-main-aside.scaffold-layout--reflow > div > div > main > div > div > section:nth-child(2) > div > div.scaffold-finite-scroll__content > div'); | |
[...notificationList.children].map(notification => { | |
const titleDiv = notification.querySelector('article > div > div.display-flex.flex-column.flex-grow-1.mr2 > a') | |
if (titleDiv && titleDiv.innerText.includes('reacted')) { | |
notification.style.display = 'none'; | |
} | |
}) | |
} |
This file contains hidden or 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 { RekognitionClient, DetectModerationLabelsCommand } from "@aws-sdk/client-rekognition"; | |
const moderationCategories = [ | |
"Explicit Nudity", | |
"Explicit Sexual Activity", | |
"Hate Symbols", | |
]; | |
const runModeration = async (Body: ArrayBuffer) => { | |
const command = new DetectModerationLabelsCommand({ |
This file contains hidden or 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
export const handler = async (event) => { | |
// TODO implement | |
//#Source https://bit.ly/2neWfJ2 | |
const hz = (fn, iterations = 100) => { | |
const before = performance.now(); | |
for (let i = 0; i < iterations; i++) fn(); | |
return (1000 * iterations) / (performance.now() - before); | |
}; | |
// 10,000 element array | |
const numbers = Array(10000) |
This file contains hidden or 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
export const handler = async (event) => { | |
// TODO implement | |
//#Source https://bit.ly/2neWfJ2 | |
const hz = (fn, iterations = 100) => { | |
const before = performance.now(); | |
for (let i = 0; i < iterations; i++) fn(); | |
return (1000 * iterations) / (performance.now() - before); | |
}; | |
// 10,000 element array | |
const numbers = Array(10000) |
This file contains hidden or 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
// https://gist.github.com/SamWSoftware/b4375a7dcbbd57fc1931b798afc09423 | |
import { promisify } from 'util'; | |
import * as Axios from 'axios'; | |
import * as jsonwebtoken from 'jsonwebtoken'; | |
const jwkToPem = require('jwk-to-pem'); | |
export interface ClaimVerifyRequest { | |
readonly token: string; | |
} |
This file contains hidden or 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 testForOfAsync = async () => { | |
const start = Date.now(); | |
const getFruits = [ | |
new Promise((resolve) => {setTimeout(() => resolve('apple'), 10000)}), | |
new Promise((resolve) => {setTimeout(() => resolve('banana'), 100)}), | |
new Promise((resolve) => {setTimeout(() => resolve('orange'), 100)}) | |
] | |
for await (const fruit of getFruits) { | |
console.log(fruit, Date.now() - start) |
This file contains hidden or 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
let config = { | |
minimumScore: 50, | |
}; | |
exports.handler = async (event) => { | |
const { score, mode } = event; | |
let minimumScore = config.minimumScore | |
This file contains hidden or 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
let cachedData = {}; | |
exports.handler = async (event) => { | |
if (cachedData && cachedData.expiresOn > Date.now() ) { | |
const response = { | |
statusCode: 200, | |
body: `The weather is ${cachedData.weather} and it is ${cachedData.temperature} decrees Celcius`, | |
}; | |
return response; |
NewerOlder