Skip to content

Instantly share code, notes, and snippets.

@fourgates
fourgates / auth.ts
Last active September 27, 2024 02:15
express.js middleware to validate a AWS Cognito / Amplify Token
import { Router } from "express";
import jwt from "jsonwebtoken";
import jwkToPem from "jwk-to-pem";
import * as Axios from 'axios';
interface PublicKeys {
keys: PublicKey[];
}
interface PublicKey {
alg: string;
@lorey
lorey / selenium_xhr_requests_via_performance_logging.py
Last active July 3, 2025 15:04
Access Chrome's network tab (e.g. XHR requests) with Selenium
#
# This small example shows you how to access JS-based requests via Selenium
# Like this, one can access raw data for scraping,
# for example on many JS-intensive/React-based websites
#
from time import sleep
from selenium import webdriver
from selenium.webdriver import DesiredCapabilities
@statik
statik / waf.ts
Last active October 16, 2024 02:36
WAF with CDK examples
import * as cdk from "@aws-cdk/core";
import * as wafv2 from "@aws-cdk/aws-wafv2";
// This extends the base cdk stack properties to include a tag name input.
export interface StackProps extends cdk.StackProps {
tag: string;
applicationName?: string;
}
export class WAFStack extends cdk.Stack {
@LayZeeDK
LayZeeDK / should-i-use-an-angular-module.md
Created August 23, 2022 08:45
Should I use an Angular module?
graph TD
  A[Should I use an Angular module?] --> B{Is it a component?}
  B -->|Yes| X[Don't use an Angular module]
  B -->|No| C{Is it a directive?}
  C -->|Yes| X
  C -->|No| D{Is it a pipe?}
  D -->|Yes| X
  D -->|No| E{Is it a service?}
 E -->|Yes| X
@andreacioni
andreacioni / app.controller-1.ts
Last active February 4, 2025 14:27
NestJS Authentication: Single Sign On with SAML 2.0
@Get('api/auth/sso/saml/login')
@UseGuards(SamlAuthGuard)
async samlLogin() {
//this route is handled by passport-saml
return;
}