Skip to content

Instantly share code, notes, and snippets.

@levhita
Created May 10, 2018 21:23
Show Gist options
  • Save levhita/e6b391de60918a06929a7fb2f93712dd to your computer and use it in GitHub Desktop.
Save levhita/e6b391de60918a06929a7fb2f93712dd to your computer and use it in GitHub Desktop.
Do you want to compare the repositories of 27+ students to catch if one of them is cheating?
<?php
$dirs = array_slice(scandir('.'), 2);
for($i=0;$i<count($dirs);$i++){
if ( is_dir($dirs[$i]) ){
$base = $dirs[$i];
for($j=0;$j<count($dirs);$j++){
if ($i!=$j) {
if ( is_dir($dirs[$j]) ){
$against = $dirs[$j];
$data = `wdiff -s123 "$base/css/main.css" "$against/css/main.css"`;
$lines = explode("\n", $data);
$tokens = explode(" ", $lines[0]);
$change = (int)substr($tokens[count($tokens)-2], 0,-1);
if($change < 40 ) {
echo $lines[0];
echo "\n";
echo $lines[1];
echo "\n\n";
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment