From 3a7178e3299dcc1d707758c56eeb1f43c987ebf5 Mon Sep 17 00:00:00 2001 From: dothething <165024975+dothething1DA@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:56:06 +1000 Subject: [PATCH] Delete doc/scripts directory --- doc/scripts/README | 1 - doc/scripts/add-cc0-license.py | 14 ---------- doc/scripts/compile-all.sh | 38 -------------------------- doc/scripts/find-unreferenced-files.py | 15 ---------- doc/scripts/fix-newlines.py | 24 ---------------- doc/scripts/run-all.sh | 38 -------------------------- doc/scripts/skip_headers | 9 ------ doc/scripts/test-compiles.sh | 7 ----- 8 files changed, 146 deletions(-) delete mode 100644 doc/scripts/README delete mode 100644 doc/scripts/add-cc0-license.py delete mode 100755 doc/scripts/compile-all.sh delete mode 100644 doc/scripts/find-unreferenced-files.py delete mode 100644 doc/scripts/fix-newlines.py delete mode 100755 doc/scripts/run-all.sh delete mode 100644 doc/scripts/skip_headers delete mode 100755 doc/scripts/test-compiles.sh diff --git a/doc/scripts/README b/doc/scripts/README deleted file mode 100644 index a7adf57..0000000 --- a/doc/scripts/README +++ /dev/null @@ -1 +0,0 @@ -Just a bunch of miscellaneous scripts I don't want to throw away. You may safely ignore them. diff --git a/doc/scripts/add-cc0-license.py b/doc/scripts/add-cc0-license.py deleted file mode 100644 index 4f8d603..0000000 --- a/doc/scripts/add-cc0-license.py +++ /dev/null @@ -1,14 +0,0 @@ - -for fname in open('todo'): - fname = fname.strip() - print(fname) - with open(fname) as f: - cont = list(f) - beforeline = -1 - for i, line in enumerate(cont): - if line.startswith(' * Author:') or line.startswith(' * Date:'): - beforeline = i+1 - cont[beforeline:beforeline] = [' * License: CC0\n'] - cont = ''.join(cont) - with open(fname, 'w') as f: - f.write(cont) diff --git a/doc/scripts/compile-all.sh b/doc/scripts/compile-all.sh deleted file mode 100755 index 378e273..0000000 --- a/doc/scripts/compile-all.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash -DIR=${1:-.} - -# use a precompiled header for the template to improve perf -g++ -Wall -Wextra -Wfatal-errors -Wconversion -std=c++17 -x c++-header $DIR/content/contest/template.cpp -trap "rm -f $DIR/content/contest/template.cpp.gch" EXIT - -SCRIPT_DIR=$DIR/doc/scripts -tests="$(find $DIR/content -name '*.h' | grep -vFf $SCRIPT_DIR/skip_headers)" -echo "skipped: " -find $DIR/content -name '*.h' | grep -Ff $SCRIPT_DIR/skip_headers -declare -i pass=0 -declare -i fail=0 -failHeaders="" -for test in $tests; do - echo "$(basename $test): " - $SCRIPT_DIR/test-compiles.sh $test - retCode=$? - if (($retCode != 0)); then - echo $retCode - fail+=1 - failHeaders="$failHeaders$test\n" - else - pass+=1 - fi - echo -done -echo "$pass/$(($pass+$fail)) tests passed" -if (($pass == 0)); then - echo "No tests found (make sure skip_headers doesn't have whitespace lines)" - exit 1 -elif (($fail == 0)); then - echo "No tests failed" - exit 0 -else - echo -e "These tests failed: \n $failHeaders" - exit 1 -fi diff --git a/doc/scripts/find-unreferenced-files.py b/doc/scripts/find-unreferenced-files.py deleted file mode 100644 index d71baed..0000000 --- a/doc/scripts/find-unreferenced-files.py +++ /dev/null @@ -1,15 +0,0 @@ -import os - -for (dirpath, dirnames, filenames) in os.walk('content'): - try: - with open(os.path.join(dirpath, 'chapter.tex')) as f: - chapter_tex = f.read() - except: - continue - - for fname in filenames: - if not fname.endswith('.h') or '-codeforces' in fname: - continue - if f'{{{fname}}}' in chapter_tex: - continue - print(os.path.join(dirpath, fname)) diff --git a/doc/scripts/fix-newlines.py b/doc/scripts/fix-newlines.py deleted file mode 100644 index e474eaf..0000000 --- a/doc/scripts/fix-newlines.py +++ /dev/null @@ -1,24 +0,0 @@ -import glob - -for fname in glob.glob('content/*/*.h'): - fname = fname.strip() - with open(fname) as f: - cont = list(f) - prline = -1 - for i, line in enumerate(cont): - if line.startswith('#pragma once'): - prline = i - if prline == -1: - continue - print(fname) - while not cont[prline-1].strip(): - del cont[prline-1] - prline -= 1 - while not cont[prline+1].strip(): - del cont[prline+1] - cont[prline+1:prline+1] = ['\n'] - cont = ''.join(cont) - # print(cont) - # print() - with open(fname, 'w') as f: - f.write(cont) diff --git a/doc/scripts/run-all.sh b/doc/scripts/run-all.sh deleted file mode 100755 index 0511e51..0000000 --- a/doc/scripts/run-all.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash -DIR=${1:-.} - -# use a precompiled header for the template to improve perf -g++ -Wall -Wfatal-errors -Wconversion -std=c++17 -O2 $DIR/stress-tests/utilities/template.h -trap "rm -f $DIR/stress-tests/utilities/template.h.gch" EXIT - -tests="$(find $DIR/stress-tests -name '*.cpp')" -declare -i pass=0 -declare -i fail=0 -failTests="" -ulimit -s 524288 # For 2-sat test -for test in $tests; do - echo "$(basename $test): " - start=`date +%s.%N` - g++ -Wall -Wfatal-errors -Wconversion -std=c++17 -O2 $test && ./a.out - retCode=$? - if (($retCode != 0)); then - echo "Failed with $retCode" - fail+=1 - failTests="$failTests$test\n" - else - pass+=1 - fi - end=`date +%s.%N` - runtime=$( echo "$end - $start" | bc -l ) - echo "Took $runtime seconds" - rm -f a.out - echo -done -echo "$pass/$(($pass+$fail)) tests passed" -if (($fail == 0)); then - echo "No tests failed" - exit 0 -else - echo -e "These tests failed: \n $failTests" - exit 1 -fi diff --git a/doc/scripts/skip_headers b/doc/scripts/skip_headers deleted file mode 100644 index 174a0a4..0000000 --- a/doc/scripts/skip_headers +++ /dev/null @@ -1,9 +0,0 @@ -SolveLinear2.h -Unrolling.h -MinCostMaxFlow.h -DivideAndConquerDP.h -ModInverse.h -ModSqrt.h -Hashing-codeforces.h -NumberTheoreticTransform.h -MoQueries.h diff --git a/doc/scripts/test-compiles.sh b/doc/scripts/test-compiles.sh deleted file mode 100755 index c716d8f..0000000 --- a/doc/scripts/test-compiles.sh +++ /dev/null @@ -1,7 +0,0 @@ -mkdir -p build -FILE="$1" -echo " -#include \"../content/contest/template.cpp\" -#include \"../$FILE\" -" >build/temp.cpp -g++ -Wall -Wextra -Wfatal-errors -Wconversion -std=c++17 build/temp.cpp && rm a.out build/temp.cpp