Skip to content

Instantly share code, notes, and snippets.

Project Phoenix

A smarter way for small businesses to track sales and expenses in real-time.


🌍 The Problem

Small businesses often rely on messy spreadsheets or manual bookkeeping.
This makes it hard to track cash flow, understand profits, and make quick decisions.


{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Statement1",
      "Effect": "Allow",
      "Action": [
        "rds:CreateDBInstance",
 "rds:DeleteDBInstance",

1️⃣ Listener Port (Entry Point for Traffic)

The Listener is the first component of the Network Load Balancer (NLB) that accepts incoming traffic.

Purpose:

  • It listens for incoming requests from clients on a specific port and protocol (TCP, UDP, TLS, etc.).
  • It then forwards traffic to a Target Group based on predefined rules.

Example:

  • A listener on port 443 (TCP) will receive HTTPS requests from users.
@edwardoboh
edwardoboh / fix_api_gateway_cors.md
Created January 28, 2025 17:17
This code snippet shows how to configure cors headers on default 4XX and 5XX gateway response. This adding is neccessary for configuring CORS via the boto3 SDK
import boto3

def add_cors_headers_to_gateway_responses(api_id, region):
    client = boto3.client('apigateway', region_name=region)

    # Define the CORS headers
    cors_headers = {
        'Access-Control-Allow-Origin': "'*'",
        'Access-Control-Allow-Headers': "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",
@edwardoboh
edwardoboh / kyverno_verify_image.md
Last active January 13, 2025 14:07
Sample Kyverno policy to verify signed Images
apiVersion: kyverno.io/v1
kind: Policy
metadata:
  name: cosign
spec:
  validationFailureAction: enforce
  background: false
  webhookTimeoutSeconds: 30
 failurePolicy: Fail
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.ssl.SSLContextBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@edwardoboh
edwardoboh / nestjs-s3-upload.md
Created December 5, 2024 21:39
Code snippets for uploading assets in NestJs projects using s3 client

Controller File

import { Controller, Get, HttpCode, HttpStatus, Post, UseInterceptors, UploadedFile, Req, ParseFilePipe, MaxFileSizeValidator, FileTypeValidator, Param } from '@nestjs/common';
import { FileInterceptor } from '@nestjs/platform-express';
import { AppService } from './app.service';
import { SkipThrottle } from '@nestjs/throttler';
import { Public } from './auth/decorator/public.decorator';
import { Request } from 'express';
import { IRequestUser } from './common/interface/request-user.interface';
import { errorMessages } from './common/constant/error-messages.constant';
@edwardoboh
edwardoboh / install.md
Created September 4, 2024 01:22 — forked from Ryanb58/install.md
How to install telnet into a alpine docker container. This is useful when using the celery remote debugger in a dev environment.
>>> docker exec -it CONTAINERID /bin/sh
/app # telnet
/bin/sh: telnet: not found

/app # apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-243-gf26e75a186 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-229-g087f28e29d [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]