Skip to content

Instantly share code, notes, and snippets.

View artyom's full-sized avatar

Artyom Pervukhin artyom

View GitHub Profile
@artyom
artyom / main.go
Created February 19, 2025 23:04
Reverse proxy assisting the backend
package main
import (
"io"
"log"
"net"
"net/http"
"net/http/httputil"
"net/url"
"strings"
@artyom
artyom / bedrock-example.py
Created February 18, 2025 20:08
AWS Bedrock converse API call example
#!/usr/bin/env python3
import boto3
from botocore.exceptions import ClientError
client = boto3.client("bedrock-runtime", region_name="us-east-1")
model_id = "us.amazon.nova-micro-v1:0"
user_message = "Describe the purpose of a 'hello world' program in one line."
conversation = [
@artyom
artyom / main.go
Last active November 15, 2024 16:39
Test whether given IP belongs to AWS network
package main
import (
"bytes"
"context"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
@artyom
artyom / go.mod
Created June 22, 2024 18:26
Using AWS Bedrock converse API with Anthropic Claude 3.5 Sonnet
module bedrock-llm
go 1.23rc1
require (
github.com/aws/aws-sdk-go-v2/config v1.27.21
github.com/aws/aws-sdk-go-v2/service/bedrockruntime v1.11.0
)
require (
@artyom
artyom / go.mod
Created May 9, 2024 12:48
SQLite application defined function in Go, combined with generated column
module sqlite-generated-columns
go 1.22.3
require modernc.org/sqlite v1.29.9
require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
@artyom
artyom / result.txt
Created February 6, 2024 11:14
rate.Sometimes vs time.Ticker
goos: darwin
goarch: arm64
pkg: ids-rewrite-experiment
BenchmarkSometimes/ticker-8 387814022 2.915 ns/op
BenchmarkSometimes/sometimes-8 44387656 27.03 ns/op
Description: Tailscale SSH sessions recorder
Parameters:
VPC:
Type: AWS::EC2::VPC::Id
Description: VPC ID
Subnets:
Type: List<AWS::EC2::Subnet::Id>
Description: VPC subnets
@artyom
artyom / aws-fargate-no-internet-access.md
Created April 19, 2022 19:44
Running services on Fargate without giving them public Internet access

Running services on Fargate without giving them public Internet access

VPC Endpoints

Such setup depends on the following VPC endpoints:

  • ECR endpoints for Docker API, and ECR API;
  • S3 gateway endpoint (ECR images are backed by S3);
@artyom
artyom / goldmark-custom-header-ids.go
Last active January 14, 2022 09:37
Custom header IDs that work with headers which include formatting
package main
import (
"fmt"
"log"
"os"
"strings"
"unicode"
"github.com/yuin/goldmark"
@artyom
artyom / cdn-headers.yml
Created November 16, 2021 09:15
CloudFormation example: adding custom HTTP headers to CloudFront distribution
Description: CloudFormation custom headers test
Resources:
SiteS3Bucket:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
UpdateReplacePolicy: Delete
Properties:
BucketEncryption: