Profile cover photo
Profile photo
apostolis ntokos
apostolis's interests
View all
apostolis's posts

Post has attachment
Pass php variables values to python script
Assume the following php code: example.php <?php $var1 = "1"; $var2 = "2"; $var3 = "3"; $output = exec(" ".$var1." ".$var2." ".$var3); print $output; ?> $output variable contains python's script output Then we have to create the script....

Post has attachment
Reduction from SAT to Clique (proving NP-complete)
SAT problem description: Assume a boolean expression in CNF (conjuctive normal form). The question for this decision problem is, can you set the variables to a combination of TRUE/FALSE so that the boolean expression becomes true. (Using the laws of Boolean...

Post has shared content
Vertex Cover (python implementation)
MINIMUM VERTEX-COVER Description Formally, a vertex-cover of an undirected graph   is a subset  V′  of  V  such that if edge  (u, v)  is an edge of  G , then  u  is in  V′ , or  v  is in  V′ , or both. The set  V′  is said to "cover" the edges of  G . The f...

Post has attachment

Post has attachment
cProfile python
Python includes a profiler called cProfile. It not only gives the total running time, but also times each function separately, and tells you how many times each function was called, making it easy to determine where you should make optimizations. For exampl...

Post has attachment
Ordered Dictionary Python
In this post, we are going to examine python's dictionaries. A python dictionary has the following form: my_dict = { 'anna' : 3 , 'george' : 6 , 'john' : 2 , 'tomas' : 5 } If we print my_dict the output is going to be:  {'tomas': 5, 'john': 2, 'george': 6, ...

Post has attachment
Unittest Python
UNITTEST PYTHON   In computer programming, unit testing is a software testing method by which individual units of source code,
sets of one or more computer program modules together with associated
control data, usage procedures, and operating procedures, ...

Post has attachment
Python execute Linux commands
Executing Linux shell commands using Python In this post, we are going to execute linux shell commands in a python script using subprocess module. Example 1) import subprocess

p = subprocess.Popen( "ls /" , stdout =subprocess.PIPE, shell = True )
(output, ...

Post has attachment
IP scanning python
In order to find the IPs using python, we are going to install nmap module. You can installing it, by typing in the terminal the following command : sudo apt-get install python-nmap import nmap

nm = nmap.PortScanner()
cidr2 = '' ...

Post has attachment
Socket programming python
Socket programming 'means' server-client model                             SERVER - CLIENT  So,we have to two python script. One for the server and one for the client. For the server: from socket import *

HOST = '' #localhost / # LAN - 192.168...
Wait while more posts are being loaded