Skip to content

Instantly share code, notes, and snippets.

View donn's full-sized avatar

Mohamed Gaber donn

View GitHub Profile
@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(),
@donn
donn / 10-ALL.md
Created February 21, 2025 13:20
Results for efabless / openlane2#677 (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.4550 -0.4550 0.0000 (0.0000%) ⭕
clock__skew__worst_setup 0.4962 0.4962 0.0000 (0.0000%) ⭕
design__core__area 284814 284814 0 (0.0000%) ⭕
design__die__area 3
@donn
donn / Readme.md
Last active December 5, 2023 21:29
Lima with Rosetta 2 and Nix
  1. Install lima. Counterintuitively, the Nix version of Lima does not support the vz engine, so you will want to grab the binary from https://github.com/lima-vm/lima/releases/latest
  2. Before starting the VM for the first time, limactl edit default: Make sure the following entries are set to these values:
vmType: "vz"
rosetta:
  # Hint: try `softwareupdate --install-rosetta` if Lima gets stuck at `Installing rosetta...`
  enabled: true
  binfmt: true
@donn
donn / or-tools.log
Created December 4, 2023 23:51
Log for build failure on `or-tools`
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/lx1pw59wacirmr5mm8lwfdx4piif1g2b-source
source root is source
setting SOURCE_DATE_EPOCH to timestamp 315619200 of file source/tools/win/zip.exe
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
applying patch /nix/store/5xpjwlnv7mw62dihnzrqcj3k3b37jp85-7072ae92ec204afcbfce17d5360a5884c136ce90.patch
patching file examples/cpp/CMakeLists.txt
applying patch /nix/store/xbhc4633ci0zdxhb4y86fdkxvakd1f7a-a26602f24781e7bfcc39612568aa9f4010bb9736.patch
@donn
donn / eea.swift
Created October 20, 2023 12:16
Extended Euclidean Algorithm
struct Row: CustomStringConvertible {
var a: Int
var b: Int
var t1: Int
var t2: Int
var s1: Int
var s2: Int
var r: Int {
return self.a % self.b
@donn
donn / cnf_to_xnf.ipynb
Last active November 28, 2022 13:57
Conjunctive Normal Form to Conjunctive XOR-based form
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@donn
donn / opendbpy.py
Last active June 4, 2024 11:18
opendbpy for reference
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise RuntimeError("Python 2.7 or later required")
@donn
donn / graph.swift
Last active November 2, 2021 14:20
Swift Uniform Cost Search
#!/usr/bin/env quips
/*
Requires quips - github.com/donn/quips
yeet
Swift
--
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or