Skip to content

Instantly share code, notes, and snippets.

View AndrzejKomarnicki's full-sized avatar

Andrzej Komarnicki AndrzejKomarnicki

View GitHub Profile
const { CognitoJwtVerifier } = require("aws-jwt-verify");
module.exports.handler = async (event, context, callback) => {
try {
const verifier = CognitoJwtVerifier.create({
userPoolId: "YOUR_POOL_ID",
tokenUse: "id",
clientId: "YOU_CLIENT_ID",
});
const match = event.authorizationToken.match(/^Bearer (.*)$/);
let token = match[1]
@RafalWilinski
RafalWilinski / AWS Marketplace Contract Flow.md
Created April 16, 2022 15:08
Visual diagram of How AWS Marketplace fit into your Monthly/Annual subscriptions model
sequenceDiagram
  participant User
  participant AWS Marketplace Product Page
  participant Your Marketplace Landing Form
  participant Your subscriptions API
  participant AWS Marketplace Metering Service

  User ->> AWS Marketplace Product Page: Visits
   User ->> AWS Marketplace Product Page: Purchases contract/subscription
# Ensure the AI services opt-out policy type is enabled on the Organization
resource "aws_organizations_organization" "organization" {
enabled_policy_types = [
# ...
"AISERVICES_OPT_OUT_POLICY"
]
}
# Create the AI opt-out policy
resource "aws_organizations_policy" "ai-optout" {
@minaguib
minaguib / sectigo.md
Last active November 5, 2020 11:12
Sectigo/Comodo/USERTrust/AddTrust Certificate Expiry May 30 2020 notes

Comodo/Sectigo/USERTrust/AddTrust root certificate expiry

On May 30th 2020 (10:48am GMT / 6:48am EDT / 3:48am PDT), several root & intermediate certificates that were part of the Comodo family expired.

The expired certificates

The following certificates expired on May 30 10:48:38 2020 GMT:

@mendhak
mendhak / apigateway.tf
Last active April 24, 2024 10:52
Terraform - API Gateway with greedy path (proxy+) calling httpbin. Also includes deployment
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}
provider "aws" {
@saidsef
saidsef / lambda_cpu_cores.md
Last active February 13, 2024 13:57
AWS Lambda CPU Cores
@jeremyj
jeremyj / haproxy rate limiting
Last active June 15, 2020 17:00
haproxy rate limiting
HTTP request limiting ===================================================================================================================
frontend ft_web
# Use General Purpose Couter (gpc) 0 in SC1 as a global abuse counter
# Monitors the number of request sent by an IP over a period of 10 seconds
stick-table type ip size 1m expire 10s store gpc0,http_req_rate(10s)
tcp-request connection track-sc1 src
# refuses a new connection from an abuser
tcp-request content reject if { src_get_gpc0 gt 0 }