Skip to content

Instantly share code, notes, and snippets.


Mohamed Fawzy MohamedFawzy

View GitHub Profile
MohamedFawzy / zephir_helloworld.php
Created May 8, 2018
zephir helloworld api frm php
View zephir_helloworld.php
echo HelloWorld\Greeting::say()."\n";
MohamedFawzy / greeting.zep
Created May 8, 2018
hello world simple extension using zephir lang
View greeting.zep
namespace HelloWorld;
class Greeting
public static function say()
echo "Hello World!";
MohamedFawzy /
Created Mar 22, 2018 — forked from isaacs/
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh
View gist:a184ba9ae3cf2405b91a
ID3 Pseudocode
id3(examples, attributes)
examples are the training examples. attributes is a list of
attributes that may be tested by the learned decison tree. Returns
a tree that correctly classifies the given examples. Assume that
the targetAttribute, which is the attribute whose value is to be
predicted by the tree, is a class variable.
View Dynamic programming - knapsack
#Dynamic Programming based Python Program for 0-1 Knapsack problem
# Returns the maximum value that can be put in a knapsack of capacity W
def knapSack(W, wt, val, n):
K = [[0 for x in range(W+1)] for x in range(n+1)]
#build table k[][] in bottom up manner
View knapsack
# input
# values stored in array v
# wighets stored in array wt
#length of array n
# knapsack capcity stored in w
#A naive recursive implementation of 0-1 Knapsack Problem
# Returns the maximum value that can be put in a knapsack of
# capacity W
def knapSack(w, wt, v, n):