Skip to content

Instantly share code, notes, and snippets.

View pavly-gerges's full-sized avatar
🤖
Electrostat Lab.

Pavly Gerges (pavl_g) pavly-gerges

🤖
Electrostat Lab.
View GitHub Profile
@pavly-gerges
pavly-gerges / dijkstra-formalism.md
Last active January 24, 2025 20:00
A formalization of the Dijkstra's algorithm

Formalization of Dijkstra's Path finder

Natural English Definition:

Overview: The formal definition describes how to compute the shortest path between two vertices in a graph using a systematic approach. It formalizes the idea of Dijkstra's algorithm, where each vertex is processed step-by-step, and distances are updated to find the shortest path from a starting vertex to a terminal vertex.

Graph Representation: The graph consists of a set of vertices (𝑉) and edges (𝐸). Each edge has a weight that represents the distance between two connected vertices. These distances are stored in a matrix (𝑀), where the value at position $$𝑚_𝑖𝑗$$ represents the distance from vertex 𝑖 to vertex 𝑗.

The Shortest Path Problem:

Fix NTFS Mounting problems

Screenshot from 2025-01-24 10-37-41

pavl-x86-machine@pavl-g:~$ sudo mkdir -p /media/pavl-x86-machine/pavl-g && \ # create a directory for mount
                           sudo mount /dev/sdb2 /media/pavl-x86-machine/pavl-g # mount manually
@pavly-gerges
pavly-gerges / graph-algo.md
Last active January 21, 2025 17:41
Graph Algorithms I

Graph Algorithms I

Outline:

  • Prerequisite Terminology.
  • Mathematical Structures for representing graphs.
  • Graph traversal algorithms.

Terminology:

  • Directed graph (Or Digraph): a directed path that is composed of vertexes and edges; where edges are essentially represented by directed arcs from a vertex (known as initial vertex) to another vertex (known as terminating or end vertex).
  • Undirected graph (or Multigraph): a non-directed path that is composed of vertexes and edges; where edges are represented by non-directed arcs from a vertex to another vertex (i.e., orientation of arcs are ignored).
  • Adjacency Matrix Representation:
// The following code examines multiple routines of definining dynamic buffers in C.
// This file fires a runtime malloc() error due to a HEAP corruption error; because of buffer overflow.
// Two maneuvers are introduced to fix this
#include <stdio.h>
#include <stdlib.h>
int main() {
// buffers
@pavly-gerges
pavly-gerges / MATH-C.md
Created October 27, 2024 20:02
A mathematical approach to coding in the C programming language.

A Mathematical Approach to coding in the C programming language: Scientific Coding

Preface:

This document is devoted to showing another perspective into programming, which in its surface is the scientific programming, but in its heart and core is really intricate. The complexity is imparted due to of the incorporation of mathematical models and their implementation to the syntatics of the programming language, unlike the practical OOP and Functional paradigms, the FSA model (Finite-Automata Model) is a theoretical model. However, in this short document, I am willing to show some caveats of using the FSM models in both low-level and high-level engineering and delivering a reliable software based on a true science.

Science behind the FSA models

The scientific basis is all emerged from the scientific modelling which is now a forked entity from the scientific philosophy models.

The Finite-State-Automata Models

@pavly-gerges
pavly-gerges / switching-mux.md
Last active September 13, 2024 10:27
Elementary linear algebriac formula for MUX operations.

Preface:

This document is devoted to derive the filter gates applied on the select lines of a multiplexer before entering the main AND circuit to produce the proper truth table. The document starts first by introducing the preliminaries using a miniaturized model, the 4-to-1 Multiplexer Model, the prototypical model of a MUX circuitry.

English:

For a 4-to-1 Multiplexer case. Let, $γ$ and $φ$ be symbols designating the select lines of the multiplexer And, $i$ be the symbols designating the input lines to the multiplexer, and $q$ designate the single output line from the MUX.

Lemma.01:

$$

In file included from /media/pavl-x86-machine/pavl-g/Projects/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic4j/serial4j/serial4j-native/src/lib/jni/com_serial4j_core_terminal_NativeTerminalDevice.cpp:40:
/media/pavl-x86-machine/pavl-g/Projects/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic4j/serial4j/serial4j-native/dependencies/include/electrostatic/util/errno/errno.h:14:16: error: expected identifier before ‘(’ token
14 | typedef struct errno(errno);
| ^~~~~
/media/pavl-x86-machine/pavl-g/Projects/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic4j/serial4j/serial4j-native/dependencies/include/electrostatic/util/errno/errno.h:14:16: error: typedef ‘__errno_location’ is initialized (use ‘decltype’ instead)
14 | typedef struct errno(errno);
| ^~~~~
/media/pavl-x86-machine/pavl-g/Projects/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic4j/serial4j/serial4j-native/dependencies/include/e
digraph G { rankdir = LR; a -> b }
flowchart LR

A[] 
B[]
flowchart LR
@pavly-gerges
pavly-gerges / diagrams.md
Created August 22, 2024 04:12 — forked from blackcater/diagrams.md
Markdown Diagrams

Diagrams

Markdown Preview Enhanced supports rendering flow charts, sequence diagrams, mermaid, PlantUML, WaveDrom, GraphViz, Vega & Vega-lite, Ditaa diagrams. You can also render TikZ, Python Matplotlib, Plotly and all sorts of other graphs and diagrams by using Code Chunk.

Please note that some diagrams don't work well with file exports such as PDF, pandoc, etc.

Flow Charts

This feature is powered by flowchart.js.