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 / vscode-tmux.md
Last active July 2, 2025 19:03
How to use tmux when developing remotely with VSCode.

If you're using SSH with VSCode to develop on a remote server, this config will help you keep your terminal sessions around even if you are disconnected from the server.

This means you can log off and enjoy a coffee, and as long as your server is still up and running, you can connect back at any time and jump back into your terminal as you left it.

Start a session

tmux
@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 July 9, 2025 15:12
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