<commit_before>#!/bin/bash

if [ "$#" -ne 4 ]; then
  echo "Usage: ${0} <db> <user> <pass> <dir>"
  exit
fi

DB=$1
USER=$2
PASS=$3
DIR=$4

set -e

URL="https://www.worldcubeassociation.org/results/misc/export.html"
ZIPPED_FILENAME=$(curl -s $URL | grep -E "WCA_export[0-9_]+\.sql.zip" -o | head -n1)
FILENAME="WCA_export.sql"

cd $DIR
wget -q -c https://www.worldcubeassociation.org/results/misc/$ZIPPED_FILENAME
unzip -q -o $ZIPPED_FILENAME
if [[ "$(uname -s)" == "Darwin" ]]; then
  sed -i -e "s/CHARSET=latin1/CHARSET=utf8/g" $FILENAME
else
  sed -i $FILENAME -e "s/CHARSET=latin1/CHARSET=utf8/g"
fi<commit_msg>Fix WCA DB update script<commit_after>#!/bin/bash

if [ "$#" -ne 4 ]; then
  echo "Usage: ${0} <db> <user> <pass> <dir>"
  exit
fi

DB=$1
USER=$2
PASS=$3
DIR=$4

set -e

URL="https://www.worldcubeassociation.org/results/misc/export.html"
ZIPPED_FILENAME=$(curl -s $URL | grep -E "WCA_export[0-9a-zA-Z_]+\.sql.zip" -o | head -n1)
FILENAME="WCA_export.sql"

cd $DIR
wget -q -c https://www.worldcubeassociation.org/results/misc/$ZIPPED_FILENAME
unzip -q -o $ZIPPED_FILENAME
if [[ "$(uname -s)" == "Darwin" ]]; then
  sed -i -e "s/CHARSET=latin1/CHARSET=utf8/g" $FILENAME
else
  sed -i $FILENAME -e "s/CHARSET=latin1/CHARSET=utf8/g"
fi
{'fraction_non_alphanumeric': 0.20080321285140562, 'fraction_numerical': 0.020883534136546186, 'mean_word_length': 4.004016064257028, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3067249', 'n_tokens_mistral': 598, 'n_tokens_neox': 560, 'n_words': 119}