Skip to content

Instantly share code, notes, and snippets.

View khalidx's full-sized avatar
💭
Engineering for the ☁️

Khalid Zoabi khalidx

💭
Engineering for the ☁️
View GitHub Profile
@khalidx
khalidx / iam-read-only.md
Last active May 12, 2025 17:13
An AWS CloudFormation Template for creating a read/view-only IAM user with programmatic (CLI) access.

Read/View-Only User for AWS Account Analysis

An AWS CloudFormation Template for creating a read/view-only IAM user with programmatic (CLI) access.

Tip

This is useful for conducting a more complete analysis and inventorying of an AWS account.

The AWS IAM Role created in this CloudFormation Stack is similar to the following:

  • The AWS [ReadOnlyAccess] Managed Policy
@khalidx
khalidx / codespace-url.md
Created May 8, 2025 04:21
How to build the URL that a GitHub Codespace will use for a port.

Tip

In a Codespace, we have access to the CODESPACE_NAME and the GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN environment variables.

We can use these variables to build the corresponding URL that will be used when forwarding a port in GitHub Codespaces.

Here's how we can build the URL for the forwarded port 80:

@khalidx
khalidx / docker-apt-install.md
Created March 26, 2025 05:02
Docker Apt Install
FROM ubuntu:noble

# Install necessary packages
RUN apt update
RUN apt install -y <package-name>
RUN rm -rf /var/lib/apt/lists/*
@khalidx
khalidx / co-founder-matching.md
Created May 17, 2024 19:30
A template to use when meeting with a potential co-founder.

This is a general guideline for your first meeting with a potential co-founder.

Just replace any {variable} with information about you, your guest, or your startup.

Co-Founder Matching Template

Intro Call

Co-Founder Matching Call with {Guest} on {Date}

@khalidx
khalidx / nextjs-nested-matcher.md
Last active April 22, 2024 18:36
Match nested page routes in Next.js middleware.

Description

Next.js doesn't seem to protect routes that use getServerSideProps().

How can you protect endpoints like:

/_next/data/*/*/something.json

Is this a bug? You can get 50% of the way there with middleware, but the middleware doesn't run on /_next/data/ unless you configure it to.

@khalidx
khalidx / npm-script-globstar.md
Last active April 22, 2024 20:12
Fixing the issue with globstar paths (**/*) not working when running an npm script.

🚧 Issue Description

If you've ever run a script like npm run test from your package.json:

{
  "scripts": {
    "test": "node --test src/**/*.test.js"
  }
}
@khalidx
khalidx / new-golang-cli.md
Created November 29, 2023 07:05
Creating a new Go CLI application.

Replace <FirstName>, <LastName>, and <Email> with your information.

mkdir ./cli/ && cd ./cli/
go install github.com/spf13/cobra-cli@latest
cobra-cli init --author "<FirstName> <LastName> <Email>" --license MIT --viper
go mod tidy
@khalidx
khalidx / startup-success.md
Last active February 6, 2024 11:48
A distilled summary of Sam Altman's "How to Succeed with a Startup".

Sam Altman - How to Succeed with a Startup

Watch the full Y Combinator talk on YouTube from Aug 29, 2018 here: https://youtu.be/0lJKucu6HJc

Summary

  1. Build a product so good, people spontaneously tell their friends about it.
  2. Build a product that is easy to explain in a few words.
  3. Identify a market that is going to grow every year.
  4. A real trend is one where the early adopters use it obsessively.
@khalidx
khalidx / node-typescript-esm.md
Last active April 15, 2025 14:15
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@khalidx
khalidx / fix-mac-chrome-no-clicks.md
Last active October 31, 2023 21:03
A (possible) fix for not being able to click around a webpage in Chrome on macOS.

Issue Description

After upgrading my MacBook Air M1 to macOS Sonoma 14.0 (not sure if it is related to this issue), I noticed that I often cannot click anything inside a webpage in Chrome, even though I can scroll the page.

Also, sometimes the navigation buttons don't work either.

Resolution Steps

It appears that this fix may have resolved the issue. The inspiration for this fix came from the following Apple community discussion thread: