Skip to content

Instantly share code, notes, and snippets.

View demsey2's full-sized avatar

Dawid Tomkalski demsey2

View GitHub Profile
#!/usr/bin/env python3
"""
AWS Identity Collector: Extract Trust and Privilege Data Across Accounts
This script collects identity and access metadata from one or more AWS accounts,
including IAM roles, IAM users, SSO (AWS IAM Identity Center) users, and their policies.
It’s used as a precursor for analyzing trust relationships and admin-equivalent access
across AWS environments.
@mmazzarolo
mmazzarolo / country-codes.ts
Created May 6, 2023 12:09
WIP - Type-safe TypeScript ISO 3166 country codes (names, two-letters codes, and three-letters codes)
// ==========================================
// (WIP) TYPE-SAFE ISO 3166 COUNTRY CODES
// ==========================================
/**
* Countries data.
* This is the source that should be updated if you want to add/remove new country codes.
*/
const countriesData = [
["Afghanistan", "AF", "AFG"],
@DavidWells
DavidWells / javascript-proxy-as-rest-client.js
Last active July 31, 2025 20:51
Using a javascript proxy as low code REST client
/* Using a JavaScript proxy for a super low code REST client */
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3
// also see https://github.com/fastify/manifetch
// also see https://github.com/flash-oss/allserver
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {
@axelabs
axelabs / expAws.sh
Last active July 28, 2023 00:45
Export selected AWS profile into environments 🐚
# Usage from POSIX shell: . ./expAws.sh
PROFILES=$(awk configure list-profiles)
select PROFILE in $PROFILES; do
export AWS_ACCESS_KEY_ID="$(aws configure get aws_access_key_id --profile $PROFILE)"
export AWS_SECRET_ACCESS_KEY="$(aws configure get aws_secret_access_key --profile $PROFILE)"
export AWS_DEFAULT_REGION="$(aws configure get region --profile $PROFILE)"
export AWS_SESSION_TOKEN="$(aws configure get aws_session_token --profile $PROFILE)"
export AWS_SECURITY_TOKEN="$(aws configure get aws_security_token --profile $PROFILE)"
@kennovation1
kennovation1 / busmon.py
Last active February 8, 2025 14:04
Continuously monitor and pretty print Amazon EventBridge traffic as captured in CloudWatch Logs
# busmon.py
# Monitor CloudWatch Logs for EventBridge traffic.
#
# This script assumes that there is a Lambda function snooping an EventBridge bus
# and logging the events to a CloudWatch Logs group.
#
# Your format will likely be different and will require slight adjustments to the parsing
# logic below. The default format assumed for this version is:
# timestamp and other stuff|field|field|field|SNOOPED detail-type: <eventName> jsonString
# That is 5 pipe-delimited fields, where the last field is the only field used.
@bodokaiser
bodokaiser / context.ts
Last active June 19, 2025 19:36
React Hook integration for AWS Amplify Auth
import React from "react"
import { CognitoUser } from "@aws-amplify/auth"
import { useAuth } from "./hooks"
import { SignInInput } from "./types"
interface AuthState {
user: CognitoUser | null
signIn(input : SignInInput): Promise<void>
signOut(): Promise<void>
@reggi
reggi / question-nestjs-graphql-nested-resolvers.md
Last active July 10, 2023 14:11
How do I have nested resolvers in nestjs / type-graphql?

I am trying to find a way that a resolver can essentially return another resolver using [nest.js][1] for creating [Resolvers][2], and [type-graphql][3] to create [object types][4].

Here's an example with the star-wars graphql api

{
  allVehicles(first: 1, last: 100) {
    vehicles {
      name
@martinheld
martinheld / GraphQL introspection query via curl.md
Last active August 15, 2025 00:10
GraphQL introspection query via curl

GraphQL introspection query via curl

cat introspection_query.json

{ 
  "query": "query IntrospectionQuery {
      __schema {
        queryType { name }
        mutationType { name }
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active October 10, 2025 02:37
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
/** Used by Flavor to mark a type in a readable way. */
export interface Flavoring<FlavorT> {
_type?: FlavorT;
}
/** Create a "flavored" version of a type. TypeScript will disallow mixing flavors, but will allow unflavored values of that type to be passed in where a flavored version is expected. This is a less restrictive form of branding. */
export type Flavor<T, FlavorT> = T & Flavoring<FlavorT>;
/** Used by Brand to mark a type in a readable way. */
export interface Branding<BrandT> {
_type: BrandT;