This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FileStats(file) { | |
nb_js = 0 | |
nb_img = 0 | |
nb_css = 0 | |
nb_others = 0 # also html/text | |
nb_lines = 0 | |
cmd = sprintf("%s %s", "jq '(.log.entries[]|[ .request.url])|@csv'", file) | |
while (cmd|getline) { | |
if (/\.png|\.jpg|\.gif/) { | |
nb_img++ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int median(Vector a, int lo, int hi) { | |
if (lo == hi) { | |
return a.get(lo); | |
} | |
int n = a.size() / 2; | |
for (;;) { | |
int pivotIndex = randomPivot(lo, hi); | |
pivotIndex = partition(a, lo, hi, pivotIndex); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Révision; | |
import java.util.Arrays; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.LinkedList; | |
import java.util.Map; | |
import java.util.PriorityQueue; | |
import java.util.Queue; | |
import java.util.Stack; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################# | |
# PageRank algorithm using the power method # | |
# youri mouton 18/08/2017 # | |
############################################# | |
# Adjacency matrix | |
A = [ 0 2 0; | |
0 0 2; | |
1 1 0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
method matmul(a: array2<int>, b: array2<int>) returns (c : array2<int>) | |
requires a != null | |
requires a.Length0 > 0 && a.Length1 > 0 | |
requires a.Length0 == a.Length1 // que pour matrices carrées | |
requires b != null | |
requires b.Length0 > 0 && b.Length1 > 0 | |
requires b.Length0 == b.Length1 // que pour matrices carrées | |
requires a.Length0 == b.Length0 | |
requires a.Length1 == b.Length1 | |
ensures fresh(c) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Calcu; | |
import java.awt.GridLayout; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.io.BufferedReader; | |
import java.io.FileInputStream; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.Random; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Reviewed par Marco Saerens le 13/01/2017 | |
% matrice des degres sortants | |
n = size(A) | |
D = diag(sum(A, 2)) | |
% matrice de probabilites de transition | |
P = D^-1 * A | |
% ajout d'un lien faible entre tous les liens | |
alpha = 0.85 | |
% vecteur de 1 de taille n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compute the edit-distance of two strings, also called the Levenstein number. | |
function lev(x, y) | |
# edit-distance array | |
xl = length(x) + 1 | |
yl = length(y) + 1 | |
m = zeros(Int, xl, yl) | |
# init first line and column | |
for i = 1 : yl | |
m[1, i] = i - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PageRank | |
# Le graphe en exemple est celui de la Q4 de l'exam 09/2015: | |
# | |
# 1 -----→ 4 | |
# ↑ \ ↑ | |
# | `---↘ | | |
# 2 -----→ 3 | |
# | |
# Matrice d'adjacence: | |
A = [ 0 1 1 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# C(n,r) | |
function C(n::Int, r::Int) | |
return (factorial(n)) / (factorial(r)*factorial(n - r)) | |
end | |
# P(n,r) | |
function P(n::Int, r::Int) | |
return (factorial(n) / factorial(n -r)) | |
end | |
# Sum of a function in a j .. n range | |
function ∑(j::Int, n::Int, f::Function) |
NewerOlder