Skip to content

Instantly share code, notes, and snippets.

View shashikhanal's full-sized avatar

Shashi Khanal shashikhanal

View GitHub Profile
@shashikhanal
shashikhanal / aws-vpc-triad-blog.yaml
Created December 12, 2024 04:32
Diagram-as-code for AWS architecture with VPC, public and private subnets, EC2 instances in security groups, and IAM roles for access control. Used in the blog.
Diagram:
DefinitionFiles:
- Type: URL
Url: "https://raw.githubusercontent.com/awslabs/diagram-as-code/main/definitions/definition-for-aws-icons-light.yaml"
Resources:
Canvas:
Type: AWS::Diagram::Canvas
Direction: vertical
Children:
@shashikhanal
shashikhanal / PostgresConnection.class
Last active November 25, 2024 23:39
Pseudocode implementation of PostgresConnection class (Gist for a Blog)
// pseudocode implementation of PostgresConnection class
Class PostgresConnection:
// properties
asyncQueryQueue = [] // queue of queries to execute asynchronously
pendingAsyncQueriesBucket = [] // bucket of queries currently being processed
Constructor:
// initialize database connection
syncConnection = postgresConnections[syncConnectionHash]; // handles synchronous database queries
asyncConnection = postgresConnections[asyncConnectionHash]; // handles asynchronous database queries