Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Mohamed Fawzy MohamedFawzy

🎯
Focusing
View GitHub Profile
@MohamedFawzy
MohamedFawzy / zephir_helloworld.php
Created May 8, 2018
zephir helloworld api frm php
View zephir_helloworld.php
<?php
echo HelloWorld\Greeting::say()."\n";
@MohamedFawzy
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
MohamedFawzy / node-and-npm-in-30-seconds.sh
Created Mar 22, 2018 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
View node-and-npm-in-30-seconds.sh
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | 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):