Profile cover photo
Profile photo
apostolis ntokos
21 followers
21 followers
About
Communities and Collections
View all
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("example.py ".$var1." ".$var2." ".$var3); print $output; ?> $output variable contains python's script output Then we have to create the example.py script....

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 ip_scan.py import nmap

nm = nmap.PortScanner()
cidr2 = '192.168.1.99/24' ...

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 / 192.168.1.1 # LAN - 192.168...

Post has attachment
Find all .txt files
In this post, you are going to see how to find all .txt files in your computer using python's os module. You can see the code below: import os def find_all_txtfiles(): for root, dirs, files in os.walk( "/" ): for file in files: if file.endswith( ".txt" ): p...
Wait while more posts are being loaded