<commit_before>#/usr/bin/env bash
set -x
if [[ ! -f /var/lib/mysql/ibdata1 ]]; then
    mysql_install_db
    /usr/bin/mysqld_safe &
    sleep 10s

    x="root123"
    cat > "/tmp/secure.sql" << EOF
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test; DELETE FROM mysql.db WHERE DB='test' OR DB='test\\_%';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '$x' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY '$x' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.17.42.1' IDENTIFIED BY '$x' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EOF
    echo "*** Securing MySQL ($host)..."
    /usr/bin/mysql -uroot -h127.0.0.1 < /tmp/secure.sql; rm -f /tmp/secure.sql

    killall -15 mysqld_safe mysqld
    chown -R mysql.mysql /var/lib/mysql
    sleep 10s
fi
# mount fix
grep -v rootfs /proc/mounts > /etc/mtab
/usr/bin/mysqld_safe &

# generate ssh keys
[[ ! -f /etc/ssh/ssh_host_rsa_key ]] && service sshd start && service sshd stop<commit_msg>Generate ssh keys for centos 7 docker container<commit_after>#/usr/bin/env bash
set -x
if [[ ! -f /var/lib/mysql/ibdata1 ]]; then
    mysql_install_db
    /usr/bin/mysqld_safe &
    sleep 10s

    x="root123"
    cat > "/tmp/secure.sql" << EOF
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test; DELETE FROM mysql.db WHERE DB='test' OR DB='test\\_%';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '$x' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY '$x' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.17.42.1' IDENTIFIED BY '$x' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EOF
    echo "*** Securing MySQL ($host)..."
    /usr/bin/mysql -uroot -h127.0.0.1 < /tmp/secure.sql; rm -f /tmp/secure.sql

    killall -15 mysqld_safe mysqld
    chown -R mysql.mysql /var/lib/mysql
    sleep 10s
fi
# mount fix
grep -v rootfs /proc/mounts > /etc/mtab
/usr/bin/mysqld_safe &

# generate ssh keys
if [[ ! -f /etc/ssh/ssh_host_rsa_key ]]; then
    ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
    ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
fi
{'fraction_non_alphanumeric': 0.15567054764984908, 'fraction_numerical': 0.03234152652005175, 'mean_word_length': 3.225865209471767, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, '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': '106684', 'n_tokens_mistral': 1006, 'n_tokens_neox': 920, 'n_words': 265}