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
type Prediction = { | |
status: "starting" | "processing" | "succeeded" | "failed" | "canceled"; | |
id: string; | |
output: string; | |
}; | |
const captionAnImage = async () => { | |
const body = JSON.stringify({ | |
version: "2e1dddc8621f72155f24cf2e0adbde548458d3cab9f00c0139eea840d0ac4746", | |
input: { |
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 payload = { | |
model: "gpt-4", | |
messages: [ | |
{ | |
content: `Tell me the days of the week.`, | |
role: "user", | |
} as ChatGptMessage, | |
], | |
temperature: 0.8, | |
top_p: 1, |
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
# gitc "Fix - The dropdown in the bubble menu should forget its state" | |
gitc () { | |
msg=${1:-'Quick commit'} | |
git add . && git commit -m "$msg" && git push origin "$(git branch | sed -n "/\* /s///p")" | |
} |
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
-- Docs: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/PostgreSQL-Lambda.html | |
-- Add the lambda extension | |
CREATE EXTENSION IF NOT EXISTS aws_lambda CASCADE; | |
-- Add a trigger to a table | |
create trigger item_insert_trigger after | |
insert | |
on | |
public.item for each row execute function item_insert_entry(); |
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
# Prompt AWS Pricing for IOT Core Example | |
Pricing example for a workload using all AWS IoT Core components | |
You have 100,000 devices that maintain a constant connection to AWS IoT Core for 30 days in the Europe (Ireland) region. Each day, each device sends 325 messages of 1 KB in size. Of the 325 messages sent per device each day, 100 trigger a Device Shadow update and 200 trigger a rule that executes one action. Your charges would be calculated as follows: | |
Connectivity Charges | |
Minutes of connection = 100,000 connections * 60 minutes/hour * 24 hours/day * 30 days = 4,320,000,000 minutes of connection | |
Connectivity charges = 4,320,000,000 minutes of connection * $0.08/1,000,000 minutes of connection = $345.60 | |
Messaging Charges | |
Messages = 100,000 devices * 325 messages/device-day * 30 days = 975,000,000 messages |
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
src/shapes/scrollbox | |
// Shape | |
import type { TLShape } from '@tldraw/core' | |
export interface ScrollBoxShape extends TLShape { | |
type: 'scrollbox' | |
size: number[] | |
} |
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 * as AWS from "aws-sdk"; | |
import { retry } from "ts-retry-promise"; | |
import { v4 } from "uuid"; | |
import { makeApiGatewayScanner } from "./adapters/makeApiGatewayScanner"; | |
const iam = new AWS.IAM(); | |
var sts = new AWS.STS(); | |
export const getAccountId = async (): Promise<string | undefined> => { | |
const identity = await sts.getCallerIdentity().promise(); |
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 { createAWSClient } = require("easy-aws-utils"); | |
const exec = async () => { | |
const { aws, access, s3Helper } = await createAWSClient(); | |
// The access details you have configured | |
console.log(JSON.stringify(access, null, 2)); | |
// The organisations in the left bar | |
const ssoUrls = access.organisations.map((o) => o.ssoStartUrl); |
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 taskWaitThreeHours = new sfn.Wait(this, "Wait 3 hours for tasks to have executed.", { | |
time: sfn.WaitTime.duration(cdk.Duration.hours(3)) | |
}); | |
const deprovisionLambda = new nodeLambda.NodejsFunction(this, "deprovisionFn", { | |
runtime: lambda.Runtime.NODEJS_14_X, | |
entry: "workflow/deprovision.ts", | |
handler: "main", | |
timeout: cdk.Duration.seconds(30), | |
logRetention: logs.RetentionDays.ONE_MONTH, |
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
await Promise.all([$`sleep 1; echo 1`, $`sleep 2; echo 2`, $`sleep 3; echo 3`]); |
NewerOlder