<commit_before>#!/usr/bin/php
<?php
/**
 * It's a helper function to update larvael .env file automatically.
 * It's written in a PHP because I have lack knowledge of `bash` how to do the same.
 *
 * @author AHeavyObject <<EMAIL>>
 */

echo getcwd();
$tmp = file_get_contents('tmp.txt');
$tmp = explode(PHP_EOL, $tmp);
$c = count($tmp);
$tmp2 = [
    $tmp[$c-5],
    $tmp[$c-2],
];
$keys = array_map(function($item) {
    $item = explode(' ', $item);
    return $item = end($item);;
}, $tmp2);

echo PHP_EOL. ' Updating .env file with keys ' . PHP_EOL;
foreach ($keys as $key) {
    echo 'PERSONAL_CLIENT_SECRET=' . $key . PHP_EOL;
}

$filePath = $argv[1]. '/.env';
$env = file_get_contents($filePath);
$env = explode(PHP_EOL, $env);
$i = 0;

foreach ($env as $key => $value) {
    if (0 === strpos($value, 'DB_PASSWORD=')) {
        $env[$key] = 'PERSONAL_CLIENT_SECRET=' . $keys[$i];
        $i++;
    }
}<commit_msg>Fixes script error<commit_after>#!/usr/bin/php
<?php
/**
 * It's a helper function to update larvael .env file automatically.
 * It's written in a PHP because I have lack knowledge of `bash` how to do the same.
 *
 * @author AHeavyObject <<EMAIL>>
 */

echo getcwd();
$tmp = file_get_contents('tmp.txt');
$tmp = explode(PHP_EOL, $tmp);
$c = count($tmp);
$tmp2 = [
    $tmp[$c-5],
    $tmp[$c-2],
];
$keys = array_map(function($item) {
    $item = explode(' ', $item);
    return $item = end($item);;
}, $tmp2);

echo PHP_EOL. ' Updating .env file with keys ' . PHP_EOL;
foreach ($keys as $key) {
    echo 'PERSONAL_CLIENT_SECRET=' . $key . PHP_EOL;
}

$filePath = $argv[1]. '/.env';
$env = file_get_contents($filePath);
$env = explode(PHP_EOL, $env);
$i = 0;

foreach ($env as $key => $value) {
    if (0 === strpos($value, 'DB_PASSWORD=')) {
        $env[$key] = 'DB_PASSWORD=' . $keys[$i];
        $i++;
    }
}
{'fraction_non_alphanumeric': 0.20414847161572053, 'fraction_numerical': 0.007641921397379912, 'mean_word_length': 3.525925925925926, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4867167', 'n_tokens_mistral': 727, 'n_tokens_neox': 716, 'n_words': 186}