Skip to content

Instantly share code, notes, and snippets.

View mohamedawnallah's full-sized avatar

Mohamed Awnallah mohamedawnallah

View GitHub Profile
@mohamedawnallah
mohamedawnallah / microgpt.py
Created February 21, 2026 02:26 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
{"instruction":"What is the next step in making this?","response":"1. Prepare all ingredients\n2. Heat pan on medium-high heat\n3. Add oil\n4. Cook protein first until done\n5. Remove protein and set aside\n6. Add vegetables in order of cook time\n7. Return protein to pan\n8. Add sauce\n9. Toss until sauce thickens\n10. Serve immediately over rice","reasoning":"All prep must be done before heating pan. Pan must be very hot before adding oil. Protein cooked separately to avoid steaming. Vegetables added by cook time ensures even cooking.","rule_id":"RULE_PRECONDITIONS","task_domain":"cooking","reasoning_source":"EleutherAI\/gpt-neox-20b"}
{"instruction":"How do I make fruit salad?","response":"1. Wash and cut fruit\n2. Combine all ingredients in a bowl\n3. Toss until fruit is evenly coated\n4. Serve immediately","reasoning":"All prep must be done before combining. Fruit must be washed and cut before adding to bowl. Tossing ensures even coating.","rule_id":"RULE_PRECONDITIONS","task_domain":"cooking","reasoning
@mohamedawnallah
mohamedawnallah / benchmark_lnd_namespace.sh
Last active November 8, 2025 16:17
Reproducing LND blocks rescan issue when wallet created during headers sync
#!/bin/bash
# LND Benchmark Script with Linux Namespaces and Temporary Storage
# Runs LND in isolated network, PID, and mount namespaces with ephemeral tmpfs storage
# Configuration
VERSION="${1:-$(git describe --tags --always --dirty 2>/dev/null || echo 'unknown')}"
ALIAS="${2:-default}"
LND_BIN="$(pwd)/lnd-debug-${VERSION}"
LNCLI_BIN="$(pwd)/lncli-debug-${VERSION}"
get_coauthor() {
local github_user="$1"
if [[ -z "$github_user" ]]; then
echo "Usage: get_coauthor <github_username>"
echo "Example: get_coauthor mohamedawnallah"
return 1
fi
# Normalize the input username.
local normalized_input=$(echo "$github_user" | tr -d ' ' | tr '[:upper:]' '[:lower:]')
// Copyright (c) 2025 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package wallet
import (
"fmt"
"testing"
"time"
@mohamedawnallah
mohamedawnallah / my_docker_config.json
Created August 20, 2025 14:58
My Docker Desktop Config
{
"ID": "cc885c6f-bb0a-4b46-8960-cff38aa91c88",
"Containers": 0,
"ContainersRunning": 0,
"ContainersPaused": 0,
"ContainersStopped": 0,
"Images": 0,
"Driver": "overlayfs",
"DriverStatus": [
[
@mohamedawnallah
mohamedawnallah / experiments
Created August 20, 2025 14:46
Claude Help in resolving issue BEAM #35916
This is a common issue when building `grpcio-tools` on ARM64/aarch64 architecture. The compilation is failing during the C++ extension build process. Here are several solutions to try:
## Solution 1: Use Pre-compiled Wheels
First, try updating pip and using pre-compiled wheels instead of building from source:
```dockerfile
# Update your Dockerfile line 65 to:
RUN pip3 install --upgrade pip setuptools wheel && \
pip3 install --only-binary=grpcio,grpcio-tools grpcio-tools mypy-protobuf
```
@mohamedawnallah
mohamedawnallah / dynamic_commitment_sequence_diagram.md
Created August 5, 2025 13:02
Sequence Diagram: Dynamic Commitment Update Flow
sequenceDiagram
    participant User
    participant LND_A as LND Node A
    participant LND_B as LND Node B

    %% Initialization Phase
    User->>LND_A: UpdateChannelParams RPC
    LND_A->>LND_A: Status: Initialized
    LND_A->>LND_A: Validate parameters
@mohamedawnallah
mohamedawnallah / test_runner.sh
Created July 22, 2025 13:36
Test supporting user defined pytest markers in Beam #35655 PR
#!/bin/bash
# Test cases
commands=(
"./run_pytest.sh test_suite 'tests/unit' ''"
"./run_pytest.sh test_suite 'tests/unit' '--maxfail=3 -m slow -n 4'"
"./run_pytest.sh test_suite 'tests/integration' '--maxfail=3 -m \"slow or flaky\" -n 4'"
"./run_pytest.sh test_suite 'tests/unit' '--maxfail=3 -m 'slow or flaky and not unreliable' -n 4'"
"./run_pytest.sh test_suite 'tests/unit' '--maxfail=3 -m slow -k test_function -n 4'"
"./run_pytest.sh test_suite '' '--maxfail=3 -m nonexistent_marker'"
@mohamedawnallah
mohamedawnallah / experiments_result.log
Last active July 12, 2025 08:05
Neutrino Headers Import Memory Profiling Experiments
dev@dev:~/side-header-loading-ab-testing-experiments/neutrino_playground$ ./script.sh
--- Benchmarking with memory limit: 16MB (16777216 bytes) ---
16777216
0
./script.sh: line 11: 6017 Killed timeout 300s sudo cgexec -g memory:neutrino_headers_import_mem_limiter /usr/local/go/bin/go run main.go 2> /dev/null
App Exit Code: 137
Total Time: .149283609 seconds
Peak Memory Usage (from events.local:max): 1408 bytes
OOM Events: 72
OOM Kills: 2