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
package main | |
import ( | |
"context" | |
"encoding/json" | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"time" |
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
var fathomSnippet = document.createElement('script'); | |
fathomSnippet.defer = true; | |
fathomSnippet.setAttribute('data-site', '<your-site-code>'); | |
fathomSnippet.src = 'https://cdn.usefathom.com/script.js'; | |
document.head.appendChild(fathomSnippet); |
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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"os" | |
"github.com/aws/aws-lambda-go/lambda" | |
) |
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
RebuildSiteWebhook: | |
Type: AWS::Serverless::Function | |
Metadata: | |
BuildMethod: go1.x | |
Properties: | |
Description: !Sub | |
- Stack ${AWS::StackName} Function ${ResourceName} | |
- ResourceName: RebuildSiteWebhook | |
CodeUri: cmd/functions/rebuildSiteWebhook | |
Runtime: provided.al2 |
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
MyDB: | |
Type: AWS::DynamoDB::Table | |
Properties: | |
AttributeDefinitions: | |
- AttributeName: id | |
AttributeType: S | |
BillingMode: PAY_PER_REQUEST | |
KeySchema: | |
- AttributeName: id | |
KeyType: HASH |
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
- name: Build resources | |
run: | | |
curl -L https://go.dev/dl/go1.19.linux-arm64.tar.gz | sudo tar -zx -C /usr/local | |
PATH=$PATH:/usr/local/go/bin:/root/go/bin | |
GOPROXY=direct | |
sam build --template ${SAM_TEMPLATE} |
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
env: | |
PIPELINE_USER_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
PIPELINE_USER_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SAM_TEMPLATE: template.yaml | |
TESTING_STACK_NAME: go-sam-pipe-dev | |
TESTING_PIPELINE_EXECUTION_ROLE: ${{ vars.TESTING_PIPELINE_EXECUTION_ROLE }} | |
TESTING_CLOUDFORMATION_EXECUTION_ROLE: ${{ vars.TESTING_CLOUDFORMATION_EXECUTION_ROLE }} | |
TESTING_ARTIFACTS_BUCKET: ${{ vars.TESTING_ARTIFACTS_BUCKET }} | |
TESTING_REGION: us-east-1 | |
PROD_STACK_NAME: go-sam-pipe-prod |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func longBlockingProcess(s string) { | |
fmt.Printf("Starting blocking process for %v\n", s) | |
time.Sleep(10 * time.Second) |
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
stream := resp.GetStream().Reader | |
events := stream.Events() | |
var response bedrock.AnthropicResponse | |
for { | |
event := <-events | |
if event != nil { | |
if v, ok := event.(*types.ResponseStreamMemberChunk); ok { | |
// v has fields |
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
resp, err := svc.InvokeModelWithResponseStream(context.TODO(), &bedrockruntime.InvokeModelWithResponseStreamInput{ | |
Accept: &accept, | |
ModelId: &modelId, | |
ContentType: &contentType, | |
Body: []byte(string(payloadBody)), | |
}) |
NewerOlder