Skip to content

Instantly share code, notes, and snippets.

View donn's full-sized avatar

Mohamed Gaber donn

View GitHub Profile
@donn
donn / gist:6dfaac43f726af52cbce470819c8b84c
Created November 18, 2026 11:38
nanobind in setup.py
# See: https://github.com/wjakob/nanobind/blob/af676a380af20cbc9ee59bbc93869bda7bf28ed8/src/nb_combined.cpp
# In short, don't do this
nb = Path(nanobind.source_dir()).parent
ext = Extension(
"_ext",
sources=[
*sorted((__file_dir__ / "src").glob("*.cc")),
*(
nb / "src" / (name + ".cpp")
@donn
donn / iPhone Region Codes.md
Last active November 11, 2026 10:29
iPhone Region/Country Codes

iPhone Country Codes

Why I made this

The model regions on Apple wikis are missing some entries- and the entries are lacking some information that I would be critical for international buyers: there are some extreme differences between features in some regions: FaceTime support, Dual SIM support, etc.

What's worse is some regions have multiple codes, and sometimes even imported devices from other regions.

Unfortunately, Apple does not seem to acknowledge these region numbers exist at all and resort to nebulous claims about the feature differences, and it doesn't help that there are some conflicting reports on the internet.

So I'm going to try my best to maintain an up-to-date list. Any and all confirmations, additions and denials here would be extremely helpful. Please just leave a comment.

@donn
donn / ci_local.py
Created August 2, 2026 07:08
LibreLane Dumpster Fire Local CI script
# SPDX-License-Identifier: Unlicense
# Copyright (c) 2025 Mohamed Gaber
# Please don't actually use this.
import os
import math
import yaml
import curses
from time import sleep
from pathlib import Path
from concurrent.futures import ThreadPoolExecutor
@donn
donn / Commands.sh
Last active June 1, 2026 15:22
Shell Nonsense
# These are commands I find all around the internet that I think are interesting or useful, so I'll keep 'em here:
# (None of these are complex enough to qualify for copyright in my opinion)
# Generate MAC Address
# Credit: https://discussions.apple.com/message/29028339#message29028339
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
## Linux
### An actual decent gnome-screenshot keyboard shortcut
### (also works when installing gnome-screenshot on KDE (im just used to it))
@donn
donn / Icarus Verilog Tutorial.md
Last active April 23, 2026 10:15
Icarus Verilog Tutorial
@donn
donn / chain_tests.ipynb
Created April 14, 2026 12:08
TSP High-level Testing/Nonsense
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@donn
donn / 10-ALL.md
Created March 25, 2026 19:36
Results for librelane / librelane#898 (Run api_test)
gf180mcuD/gf180mcu_fd_sc_mcu7t5v0/APU
Metric Before After Delta
antenna__violating__nets 0 0 0 (0.0000%) ⭕
antenna__violating__pins 0 0 0 (0.0000%) ⭕
clock__skew__worst_hold -0.2942 -0.2942 0.0000 (0.0000%) ⭕
clock__skew__worst_setup 0.2920 0.2920 0.0000 (0.0000%) ⭕
design__core__area 285113 285113 0 (0.0000%) ⭕
design__die__area 3
@donn
donn / main.cc
Created October 16, 2025 15:06
strtok_r vs std::getline for parsing paths
#include <vector>
#include <iostream>
#include <sstream>
/*
strtok
"a"
"b"
"c"
@donn
donn / nix_c_cpp_properties.py
Last active October 16, 2025 15:04
yosys vscode cpp properties script thing
# To be run from within `nix develop github:fossi-foundation/nix-eda/yosys_pybind11#yosys` from your yosys
# repository
#
# currently mac-only
#
# https://unlicense.org
import os
import sys
import json
import shlex
###### PDK Setup ######
import ciel
from ciel.source import StaticWebDataSource
from librelane.common import get_opdks_rev, ScopedFile
ciel.enable(
ciel.get_ciel_home(),
"sky130",
get_opdks_rev(),