Skip to content

Instantly share code, notes, and snippets.

View zaherg's full-sized avatar
🎯
Focusing

Zaher Ghaibeh zaherg

🎯
Focusing
View GitHub Profile
name description tools model color
memory-profiler
Memory profiling specialist for identifying leaks, inefficiencies, and optimization opportunities. Use proactively to analyze memory usage patterns during actual code execution.
Bash, Read, Grep, Glob
sonnet
green

You are a memory optimization expert specializing in identifying and resolving memory issues through comprehensive profiling.

@zaherg
zaherg / pg_backup.sh
Created August 19, 2025 19:19 — forked from ethicnology/pg_backup.sh
Backup selected (or all) schema from your postgres database
#!/bin/bash
# Configuration
DB_HOST=""
DB_PORT=""
DB_NAME=""
DB_USER=""
DB_PASS=""
DIR=""
DATE=$(date +"%Y%m%d_%H%M%S")
@zaherg
zaherg / readme.md
Created August 17, 2025 17:00 — forked from estysdesu/readme.md
[Kindle 4: Jailbreak and SSH] #kindle #ssh #jailbreak

Following this guide: https://wiki.mobileread.com/wiki/Kindle4NTHacking#SSH.
Using Kindle 4.1 and macOS 10.14.

  1. Connect the Kindle. It should be recognized as a USB Mass Storage Device.
  2. Download the jailbreak archive
  3. Copy data.tar.gz, ENABLE_DIAGS, and diagnostic_logs to the Kindle folder.
  4. Restart the Kindle into Diagnostics Mode.
  5. Reboot the Kindle from the Diagnostics Mode. Reboot screen should show jailbroken screensaver.
@zaherg
zaherg / 00 - Cursor AI Prompting Rules.md
Created June 10, 2025 11:21 — forked from aashari/00 - Cursor AI Prompting Rules.md
Cursor AI Prompting Rules - This gist provides structured prompting rules for optimizing Cursor AI interactions. It includes three key files to streamline AI behavior for different tasks.

Cursor AI Prompting Framework — Usage Guide

This guide shows you how to apply the three structured prompt templates—core.md, refresh.md, and request.md—to get consistently reliable, autonomous, and high-quality assistance from Cursor AI.


1. Core Rules (core.md)

Purpose:
Defines the AI’s always-on operating principles: when to proceed autonomously, how to research with tools, when to ask for confirmation, and how to self-validate.

function gas() {
local repo_dir branch owner repo api_url gh_status conclusion color
# Ensure GITHUB_TOKEN is set
if [[ -z "$GITHUB_TOKEN" ]]; then
echo "❌ GITHUB_TOKEN is not set. Export it in your shell environment."
return 1
fi
# Find the Git repo root
@zaherg
zaherg / settings.json
Created November 16, 2024 15:21 — forked from danielroe/extensions.json
VScode settings for a minimal UI
{
// Disable telemetry
"telemetry.telemetryLevel": "off",
// Zen mode
"zenMode.fullScreen": false,
"zenMode.hideTabs": true,
"zenMode.centerLayout": false,
// Theming
"workbench.iconTheme": "city-lights-icons-vsc",
"editor.fontFamily": "Dank Mono",
@zaherg
zaherg / firewall.sh
Created October 30, 2024 13:56 — forked from andrasbacsai/firewall.sh
Update a Hetzner Firewall rule with your IP address
#!/bin/bash
# Script to update a firewall rule in a Hetzner Firewall with your current IP address.
# Good if you would like to restrict SSH access only for your current IP address (secure).
#################
# WARNING: This script will overwrite all rules in the firewall rules, so make sure you
# added all the required rules.
# I use a separate firewall rule just for SSH access.
#################
@zaherg
zaherg / set-up-persistent-storage-for-K3s.md
Created October 19, 2024 09:27 — forked from ericboehs/set-up-persistent-storage-for-K3s.md
Set up persistent storage for K3s (via USB drive)

Set up persistent storage for K3s (via USB drive)

  1. Get root: ssh pi-k3s-master.local -t sudo su
  2. Find your disk via fdisk -l (e.g. /dev/sda1)
  3. Erase drive by repartitioning: mkfs.ext4 /dev/sda1
  4. Mount drive:
    mkdir /mnt/pi-k3s-storage
    chown -R ericboehs:ericboehs /mnt/pi-k3s-storage
    mount /dev/sda1 /mnt/pi-k3s-storage
    

Playground Comment Worker

This simple playground.yml creates a comment that opens a WordPress Playground and installs the plugin from the current repository. The current iteration only works with plugins that do not require a build step.

Playground test comment in action

CORS issues

Because GitHub doesn't send the right CORS headers for zip files to be able to install them in a Playground, you need a reverse proxy to bypass the CORS restrictions. The Worker below in worker.js can be used as a Cloudflare worker that

@zaherg
zaherg / README.md
Created April 26, 2024 08:01 — forked from kettanaito/README.md
Chromium on Vercel (serveless)

Chromium on Vercel (serverless)

This is an up-to-date guide on running Chromium in Vercel serverless functions in 2022. What you will read below is the result of two days of research, debugging, 100+ failed deployments, and a little bit of stress.

Getting started

Step 1: Install dependencies

Use chrome-aws-lambda that comes with Chromium pre-configured to run in serverless, and puppeteer-core due to the smaller size of Chromium distributive.