Thanks to visit codestin.com
Credit goes to gist.github.com

Skip to content

Instantly share code, notes, and snippets.

View edwardoboh's full-sized avatar
🥲

Edward O. Oboh edwardoboh

🥲
View GitHub Profile
@edwardoboh
edwardoboh / solana_dev.md
Created June 20, 2026 13:14
Introduction to Solana Development

Solana Programs with Rust + Anchor — A Foundations Lecture

How to read this

You already know some Rust and some general blockchain. What you're missing is the Solana-specific mental model, and that gap is exactly what makes Solana code look bizarre at first. The good news: almost everything in Solana descends from one idea. If you internalize that idea plus three primitives (accounts, PDAs, CPIs), every project in your course — voting, escrow, stablecoin, swap, prediction market — becomes a variation on patterns you already understand, not a new thing to memorize.

So this document is front-loaded. The first half builds the model slowly. The second half shows how Anchor packages it and how the projects compose it. Don't rush the first half.


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';