CookieViz on Mac OS X in more than 128 words

CookieViz is a visualization tool that measures the impact of cookies on your own browsing.

The page is git is

I install MAMP:

MAMP is a compilation of free open source software to manage dynamic websites on computers running macOS or Windows: Apache, the web server; MySQL, the database management system; phP, Perl or Python, programming languages used for web development.

Install Homebrew: Homebrew is a free open source software management system that simplifies the installation of software on Apple's macOS and Linux operating system.

/usr/bin/ruby -e "$(curl -fsSL"

The script asks to switch to superuser mode via the sudo command and asks to type the password several times.

At the end of the installation you get a successful installation!

I install mitmdump which is in the mitmproxy package

brew install mitmproxy

Validate the installation by tapping mitmdump –version

mitmdump --version
 Mitmproxy: 4.0.4
 Python: 3.7.5
 OpenSSL: OpenSSL 1.1.1d 10 Sep 2019
 Platform: Darwin-17.7.0-x86_64-i386-64bit

I start MAMP and not MAMP PRO which is paid

I get the home page of my Apache web server that is booted on port 8888 by default I can reach by typing localhost:8888 as url in my browser.

If I go into the MAMP -Preferences menu I can change the ports used.

I downloaded from the github source of cookieViz via the Clone and download link. It is also possible to start a terminal and place yourself at the root of the WEB Apache server.

By default the root is in /Applications/MAMP/htdocs/ but you can change it via the MAMP graphical interface

cd /Applications/MAMP/htdocs/
git clone

By default the default user of the database is "root" and password "root" To change t
he password by default: https://docume /App
lications/MAMP/Library/bin/mysqladmin -u root -p password

Adding a user phpmyadmin – mysql – user 'add a user' tab User Accounts

I added a user 'cookvi' with password 'cookvi'

I edited the file via a text editor or nano control

 The database server used by CookieViz.
 Default is 'localhost' and should be fine for most cases.
 If 'localhost' doesn't work and the database runs locally, try ''.
define ('DB_SERVER', '');


define ('DB_USER', 'cookvi');

 The password of the CookieViz database user.
define ('DB_PASSWD', 'cookvi');

I then edited the nano monitor_mitmdump.php file of the directory /soft

cd /Applications/MAMP/htdocs/CookieViz/soft/
nano monitor_mitmdump.php 

I went to http://localhost:8888/phpmyadmin/ and I created a new CookieViz base

I clicked on the created database and i used the "import" function and loaded the file /Applications/MAMP/htdocs/CookieViz/cookieviz/sql/url_referer-1.sql which contains the table structure

Edit the four values below
$PROXY-HOST – "localhost"; Proxy server addre
ss $PROXY-PORT – "8082"; Proxy server p
ort $PROXY-USER -""; Userna
me $PROXY-PASS -""; Password

CookieViz is php5 compatible and not phpt7 you should expect changes in the code:


$link - mysql_connect ('localhost', '', '') by $link - mysqli_connect ('', 'cookvi', 'cookvi','CookieViz') 
mysql_select_db ('CookieViz') by mysqli_select_db ($link, 'CookieViz')
mysql_error() by mysqli_connect_error()
mysql_query ($query) by mysqli_query ($link, $query)
mysql_fetch_assoc ($result) by mysqli_fetch_assoc ($result) 
mysql_close ($link) by mysqli_close ($link)  

Start a server mitmdump on port 8082: mit
mdump -p 8082 -w mitmdump.log

I am now launching the php script /Applications/MAMP/htdocs/CookieViz/soft/monitor_mitmdump.php

At the firefox level I went into network preference sets in the general settings and I configured the proxy

We find that we have connections that pass through the proxy Prox
y server listening at http://:8081
49915: clientconnect
5: CONNECT< cannot="" establis
h="" tls="" with="" client="" (sni:="""" tlsexception("ssl="" handshake="" error:="" error()")="[(‘SSL routines’, ‘ssl3_read_bytes’, ‘sslv3 alert bad certificate’)]" 1"" clientconnect="""" clientdisconnect=
"""" get=""
t="">< 200="" ok="" 8b="" 127.0
.0.1:49919:="" clientconnect="" 12"" clientconnect="""" get=""""
>< 200="" ok="" 8b="" 127.0.0.
1:49920:="" get="""">< 200 O
K 8b 200="" ok=""></ 200 OK 8b>

The results can then be viewed on the web server http://localhost:8888/CookieViz/cookieviz/

The Python heap sorting algorithm in less than 128 words

The principle of the heap sorting algorithm is as follows:

  • We search for the father of the last knot of the tree and we sift it: the father of a knot in a binary tree corresponds to the lower round of (i-1)/2 with i the position of the knot in the table that stores the tree.
  • Sieving a knot involves visiting his right and left son and swapping the root with the larger of the two.
  • The tree is sifted until it reaches the root, the largest number of the tree is then in the root position at the beginning of the painting.
  • The root that is the largest number is swapped with the last leaf (i.e. the n position of the table that stores the n-size tree). This number is considered to be well ordered (i.e. it is in last position and it is the largest)
  • The sieving and swapping operation is repeated by considering the subtree that goes from root to n-1 (so as not to move the number that has been correctly ordered) until we reach the left wire of the root (index 1)

See wikipedia link:

from math import
def indice_fils_gauche (noeud_pere:int):
	return (noeud_pere - 2) - 1

def indice_fils_droit (noeud_pere:int):
	return (noeud_pere - 2) - 2
#Retourne the pere node index if it exists (node must be 0)
def indice_noeud_pere(knot):
	#Si it is the lower rounding of (knot-1)/2
	return floor (knot - 1)/2)

#permute 2 elements of a table and incrementally the overall variable compteur_permutation to be initialized in the hand
def permute (table, index1: int, index2:int):
	print ("Permutation of the element" - str (index1) - "with element" - str (index2))
	print(" Before permutation: " - str (table))
	if (index1!2):
	#on back up the value of Index 1 in a temporary variable
		tmp - table[indice1]
		table[indice1] - table[indice2]
		table[indice2] - tmp
		compteur_permutation 1
	print(" After permutation: " - str (table))

#Tamise a binary tree from a parametre knot
#1. the knot is compared with the right and left wire (if they exist)
#2. we swap with the highest value
def thames (tree, knot, length):
	#On visits right and left son
	print ("Tamisage of" - str (knot) - " tree: " - str (tree)	
	indexSonRight - indice_fils_droit (knot)
	IndexLeft - indice_fils_gauche (knot)
	print ("IndexSonRight" - str (indexSon))
	print ("Left-hand index"" - str (left-hand index)

	if (indexSonRight< longueur): # si le fils droit existe longueur):="" #="" si="" le="" fils="" droit=""></ longueur): # si le fils droit existe>
		if (tre[indiceFilsDroit]e- tree[indiceFilsGauche]): #Si the right son is larger than the left wire
			if (tre[indiceFilsDroit]e- tree[noeud]): #Si the right wire is larger than the sifted knot
				permute (tree, indexSonright,knot)
		elif (tre[indiceFilsGauche]e - tre[noeud]e): #Si the left wire is higher than the sifted knot, so you swap
			permute (tree, left-hand index, knot)
	elif (Left-hand index< longueur): #Si le fils gauche existe longueur):="" #si="" le="" fils="" gauche=""></ longueur): #Si le fils gauche existe>
		if (tre[indiceFilsGauche]e - tre[noeud]e): #Si the left wire is higher than the sifted knot so we swap
			permute (tree, left-hand index, knot)
	print(" After sieving: " - str (tree))

compteur_permutation 0
tree - #[11, 222, 3, 24, 5, 46, 67, 899]On writes a tree in the form of a painting
print ("starting tree: " - str (tree)
#Tamisage initial
#on takes the last element of the arbe which is a leaf and one looks for his father
IndexDuNoeudPere - indice_noeud_pere (tree)-1) 
#on sifting is compared to the father knot with the right and left son
#puis you swap with the highest value
for i in range (DuNoeudPere index,-1,-1): #On siftto to the root
	thames (tree,i,len (tree)

permute (tree, len (tree)-1.0) #on swaps the first element and the last 
#suite sieving is the greatest value so it is placed at the end of the table

#on repeats the sieving
for i in range(len(tree)-1,1,-1): 
	indexDuNoeudPereDeI - indice_noeud_pere (i-1) #on takes the element i of the arbe which is a sheet and one looks for his father
	for j in range (duKnotPereDeI index,-1,-1): #On siftto to the root
		thames (tree, j,i)
	permute (tree, i-1.0)

print ("final result of sorting: " - str (tree))
print ("number of permutations: " - str(compteur_permutation))