Skip to content

Instantly share code, notes, and snippets.

View mido3ds's full-sized avatar

Mahmoud Adas mido3ds

  • Atomica.ai
  • Egypt
View GitHub Profile
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project source="2.7.1" version="1.0">
This file is intended to be loaded by Logisim (http://www.cburch.com/logisim/).
<lib desc="#Wiring" name="0"/>
<lib desc="#Gates" name="1"/>
<lib desc="#Plexers" name="2"/>
<lib desc="#Arithmetic" name="3"/>
<lib desc="#Memory" name="4">
<tool name="ROM">
<a name="contents">addr/data: 8 8
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project source="2.7.1" version="1.0">
This file is intended to be loaded by Logisim (http://www.cburch.com/logisim/).
<lib desc="#Wiring" name="0"/>
<lib desc="#Gates" name="1"/>
<lib desc="#Plexers" name="2"/>
<lib desc="#Arithmetic" name="3"/>
<lib desc="#Memory" name="4">
<tool name="ROM">
<a name="contents">addr/data: 8 8
/* Extended */
/* add this to Solving.h */
// current in given element
double Get_Current(const Circuit*& circiut, const Element*& element);
// current in element due to another element
// (the current that due_to_element caused in element)
double Get_Current(const Circuit*& circiut, const Element*& element, const Element*& due_to_element);
#include <cmath>
#include <cassert>
// round num to given precision
double Round(const double &num, const int precision)
{
int helper = pow(10, precision);
// check helper is not zero
assert(helper != 0 && "dividing on zero");
@mido3ds
mido3ds / Makefile
Created April 7, 2017 22:00
old makefile, i want to keep
# compiler to use
CC = g++
# flags to pass compiler
CFLAGS = -ggdb3 -O0 -Qunused-arguments -std=c++11 -Wall -Werror
# name for executable
EXE =
# space-separated list of header files
@mido3ds
mido3ds / Base.hpp
Last active February 25, 2024 17:09
template inheritance in c++
template<typename T>
class Base
{
public:
T someVariable;
};
@mido3ds
mido3ds / 1.cpp
Created May 29, 2017 11:55
c++ rethrow cases
#include <iostream>
using namespace std;
class except1 {};
class except2 {};
void someFunction() {
try {
throw except1();
} catch(const except1& e) {
@mido3ds
mido3ds / infiniteAndroidTouch.py
Created June 8, 2017 01:43
generate infinite touches at android device using monkeyrunner api, useful for cheating in games ;)
print 'importing libraries..'
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
print 'waiting for connection...'
device = MonkeyRunner.waitForConnection()
pos = (500, 1000)
print 'touching at ', pos
while True:
@mido3ds
mido3ds / Install-omnetpp-debian.md
Last active November 18, 2020 18:38
Install Omnet++ on debian/ubuntu

To install Omnet++ on debian/ubuntu

$ sudo apt update && sudo apt install -y build-essential gcc g++ bison flex perl \
 python python3 qt5-default libqt5opengl5-dev tcl-dev tk-dev \
 libxml2-dev zlib1g-dev default-jre doxygen graphviz wget tar qtbase5-dev qt5-qmake libopenscenegraph-dev &&
sudo apt install -y libosgearth-dev &&
wget -c https://github.com/omnetpp/omnetpp/releases/download/omnetpp-5.6.2/omnetpp-5.6.2-src-linux.tgz &&
tar xzf omnetpp-5.6.2-src-linux.tgz &&
cd omnetpp-5.6.2 &amp;&amp;