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
/** | |
* Builds a lookup table (256 elements) for fast CRC-32 calculations. | |
* | |
* The table is built using the standard polynomial 0xEDB88320 (also known as | |
* the 'reverse' polynomial used in the CRC-32 algorithm). Each of the 256 | |
* possible byte values is processed to find the remainder when treated as | |
* input to the polynomial division used in CRC-32. | |
*/ | |
function buildLookupCRC32LookupTable(): Uint32Array { | |
// Create a new 32-bit unsigned integer array of length 256. |
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
/** | |
* Calculates the Damerau-Levenshtein distance between two strings. | |
* | |
* The Damerau-Levenshtein distance is a measure of the similarity between two strings, | |
* which considers the minimum number of operations (insertions, deletions, substitutions, | |
* and transpositions of two adjacent characters) required to change one string into the other. | |
* | |
* @param source - The first string. | |
* @param target - The second string. | |
* @param limit - An optional limit to the maximum distance calculated. |
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 check_package_manager() { | |
current_dir=$(pwd) | |
while [ "$(pwd)" != "/" ]; do | |
if [ -f "pnpm-lock.yaml" ]; then | |
if [ "${1}" != "pnpm" ]; then | |
echo "Looks like you're using the wrong package manager, partner!" | |
echo "It's pnpm time, cowboy." | |
cd "${current_dir}" | |
return 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
@echo off | |
echo Grab a cuppa! Here there be dependencies... | |
mkdir -p ~/.capicli/main | |
git clone git@github.com:guardian/capicli.git ~/.capicli/main | |
cd ~/.capicli/main | |
npm install | |
npm run build | |
npm link |
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
@echo off | |
echo Grab a cuppa! Here there be dependencies... | |
git clone git@github.com:guardian/capicli.git ~/.capicli/main | |
cd ~/.capicli/main | |
npm install | |
npm run build | |
npm link |
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
pushd /tmp | |
# clone | |
git clone https://github.com/powerline/fonts.git --depth=1 | |
# install | |
cd fonts | |
./install.sh | |
# clean-up a bit | |
cd .. | |
rm -rf fonts | |
popd |
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:\Program Files\Scan Tailor\scantailor-cli.exe" -v --margins=0 --layout=1 --deskew=auto --content-detection=normal --alignment-vertical=bottom --alignment-horizontal=center --white-margins=true --color-mode=black_and_white --dpi=600 --output-dpi=600 --despeckle=off --tiff-compression=lzw --start-filter=1 --end-filter=6 C:\input\ C:\output | |
sudo apt install libjpeg zlib libpng libtiff libboost | |
or | |
sudo apt install libjpeg-dev zlib1g-dev libpng-dev libtiff5-dev libboost-all-dev | |
sudo apt install qt5-default | |
sudo apt install cmake |