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 / 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.

@pavly-gerges
pavly-gerges / switching_xor.c
Created August 22, 2024 02:58
A function that operates on a list of propositions and returns a predicate of their XORing operation using the primitive AND and OR.
#include <electrostatic/algorithm/arithmos/algebra/switching.h>
#include <stdlib.h>
uint8_t switching_xor(SWITCHING_TYPE **inputs, SWITCHING_TYPE *output){
if (inputs == NULL || output == NULL) {
return 1;
}
for (int i = 0; inputs[i] != NULL; i++) {
SWITCHING_TYPE prop0 = *output;
SWITCHING_TYPE prop1 = *(inputs[i]);
@pavly-gerges
pavly-gerges / hello_contiguous_buffer.c
Last active August 19, 2024 15:28
This is an early-access demonstrative example for the `contiguous_buffer.c` library and the List ADT from Arithmos.
#include <electrostatic/util/errno/errno.h>
#include <alloca.h>
#include <stdio.h>
#include <stdlib.h>
#include <electrostatic/algorithm/arithmos/adt/list.h>
void iterator(list *buffer, list_element *element) {
uint64_t index = 0;
buffer->function_table->indexof(buffer, element, &index);
printf("Index at %llud = %d\n", index, *((int*) element->data));
@pavly-gerges
pavly-gerges / PROPOSITIONAL_SYMBOLS_LATEX_OBSIDIAN.md
Created July 19, 2024 01:31 — forked from zudsniper/PROPOSITIONAL_SYMBOLS_LATEX_OBSIDIAN.md
📋 Propositional Logic symbols & their LaTeX formulas specifically for Obsidian flavor Markdown

Certainly! Obsidian is a popular note-taking application that supports Markdown with LaTeX integration for mathematical notation. When using LaTeX in Obsidian's Markdown flavor, you typically enclose the LaTeX code within double dollar signs $$...$$ for block math and single dollar signs $...$ for inline math.

Here's an exhaustive list of the symbols for propositional logic and their formulas specifically formatted for Obsidian flavor Markdown:

  1. Conjunction (AND)

    • Symbol: ∧
    • Obsidian Markdown: $\land$ or $\wedge$
  2. Disjunction (OR)

  • Symbol: ∨
@pavly-gerges
pavly-gerges / linking-error.log
Created June 9, 2024 21:28
Logs when linking failed at the compile-time
electrostat-lab@electrostat-workstation:~/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework$ ./helper-scripts/ci-cd/test-e4j.sh
> Task :electrostatic4j-examples:run FAILED
Jun 09, 2024 1:26:00 AM electrostatic4j.util.loader.NativeImageLoader loadLibrary
INFO: Created extraction directory!
Jun 09, 2024 1:26:01 AM com.avrsandbox.snaploader.NativeBinaryLoader cleanExtractBinary
INFO: Extracted successfully to /home/electrostat-lab/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic4j/electrostatic4j-examples/libs/bin/libelectrostatic4j.so
Jun 09, 2024 1:26:01 AM com.avrsandbox.snaploader.NativeBinaryLoader loadBinary
INFO: Successfully loaded library: /home/electrostat-lab/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic4j/electrostatic4j-examples/libs/bin/libelectrostatic4j.so
/opt/electrostatic-sandbox/jdk-20.0.2/bin/java: symbol lookup error: /home/electrostat-lab/Sandbox/Electrostatic-Sandbox/electrostatic-sandbox-framework/electrostatic4j/elec