<commit_before>#!/bin/bash

if [ "$1" == "backup" ]; then

    # Create backup dir and define the backup name
    mkdir -p ./backup/factorio
    timestamp=`date +%Y.%m.%d-%H:%m`
    dest="./backup/factorio/$timestamp.zip"

    # Get the oldest factorio save file (autosave)
    oldestfile=$(find ./games/factorio/saves -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ")

    # Copy it to the backup dir
    cp $oldestfile $dest

elif [ "$1" == "update" ]; then


    # Check if a factorio session is running
    # If it is running, shut it down and backup data.
	tmux has-session -t factorio
	if [ $? -ne 1 ]; then
        tmux send-keys -t factorio C-c
        sleep 5
        ./scripts/factorio.sh "backup"
        tmux send-keys -t factorio exit ENTER
    fi

    # Move save and config temporarily to current dir.
    mv ./games/factorio/saves ./games/factorio/config ./
    rm -rf ./games/factorio

    # Untar new factorio, move it into place and add config and saves.
    tar xf ~/factorio_headless_x64_*
    mv ./factorio ./games/factorio
    mv ./saves ./config ./games/factorio/

    # Start factorio
    ./scripts/factorio

else
	tmux has-session -t factorio

    #  Start the game, if there is no running 'factorio' session,
	if [ $? -ne 0 ]; then
		tmux new -d -s factorio
		tmux send -t factorio ./games/factorio/bin/x64/factorio SPACE --start-server-load-latest SPACE --server-settings SPACE ./games/factorio/config/server-settings.json ENTER
	fi
fi
<commit_msg>Fix .sh in factorio script<commit_after>#!/bin/bash

if [ "$1" == "backup" ]; then

    # Create backup dir and define the backup name
    mkdir -p ./backup/factorio
    timestamp=`date +%Y.%m.%d-%H:%m`
    dest="./backup/factorio/$timestamp.zip"

    # Get the oldest factorio save file (autosave)
    oldestfile=$(find ./games/factorio/saves -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ")

    # Copy it to the backup dir
    cp $oldestfile $dest

elif [ "$1" == "update" ]; then


    # Check if a factorio session is running
    # If it is running, shut it down and backup data.
	tmux has-session -t factorio
	if [ $? -ne 1 ]; then
        tmux send-keys -t factorio C-c
        sleep 5
        ./scripts/factorio.sh "backup"
        tmux send-keys -t factorio exit ENTER
    fi

    # Move save and config temporarily to current dir.
    mv ./games/factorio/saves ./games/factorio/config ./
    rm -rf ./games/factorio

    # Untar new factorio, move it into place and add config and saves.
    tar xf ~/factorio_headless_x64_*
    mv ./factorio ./games/factorio
    mv ./saves ./config ./games/factorio/

    # Start factorio
    ./scripts/factorio.sh

else
	tmux has-session -t factorio

    #  Start the game, if there is no running 'factorio' session,
	if [ $? -ne 0 ]; then
		tmux new -d -s factorio
		tmux send -t factorio ./games/factorio/bin/x64/factorio SPACE --start-server-load-latest SPACE --server-settings SPACE ./games/factorio/config/server-settings.json ENTER
	fi
fi

{'fraction_non_alphanumeric': 0.12408272181454302, 'fraction_numerical': 0.00733822548365577, 'mean_word_length': 2.4274285714285715, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7349078', 'n_tokens_mistral': 1065, 'n_tokens_neox': 998, 'n_words': 346}