<commit_before>from os.path import join, exists
from subprocess import Popen, PIPE, check_output
from shutil import rmtree
from time import sleep
from re import compile
from os import mkdir

config = '''
LoadModule rewrite_module {ModulesPath}/mod_rewrite.so
LoadModule alias_module {ModulesPath}/mod_alias.so
LoadModule dir_module {ModulesPath}/mod_dir.so
LoadModule mime_module {ModulesPath}/mod_mime.so

<IfDefine Unixd>
    LoadModule unixd_module {ModulesPath}/mod_unixd.so
</IfDefine>

<IfDefine MpmEvent>
    LoadModule mpm_event_module {ModulesPath}/mod_mpm_event.so
</IfDefine>

<IfDefine Version2.2>
    LoadModule log_config_module {ModulesPath}/mod_log_config.so
    LockFile "{ServerRoot}/accept.lock"
</IfDefine>

<IfDefine Version2.4>
    LoadModule authz_core_module {ModulesPath}/mod_authz_core.so
    Mutex file:{ServerRoot}
</IfDefine>

Listen 0.0.0.0:{Port}
PidFile "{ServerRoot}/httpd.pid"
DocumentRoot "{DocumentRoot}"
TypesConfig {MimeTypes}

<Directory "/">
    Options +FollowSymLinks
    AllowOverride Options FileInfo Indexes
</Directory>
'''

def build_site(destination, watch):
    '''
    '''
    command = 'jekyll', 'build', '-d', destination
    
    if watch:
        command += ('--watch', )
    
    Popen(command).wait()
    print 'Built to', destination

def write_config(doc_root, root, port):
    ''' Look for Apache modules, write a configuration file.
    
        Return module directory.
    '''
    mod_paths = '/usr/lib/apache2/modules', '/usr/libexec/apache2'
    mime_paths = '/etc/apache2/mime.types', '/etc/mime.types'
    
    mod_path = filter(exists, mod_paths)[0]
    mime_path = filter(exists, mime_paths)[0]
<commit_msg>Tweaked Apache mod_negiation/MultiViews settings until they work<commit_after>from os.path import join, exists
from subprocess import Popen, PIPE, check_output
from shutil import rmtree
from time import sleep
from re import compile
from os import mkdir

config = '''
LoadModule rewrite_module {ModulesPath}/mod_rewrite.so
LoadModule alias_module {ModulesPath}/mod_alias.so
LoadModule dir_module {ModulesPath}/mod_dir.so
LoadModule mime_module {ModulesPath}/mod_mime.so
LoadModule negotiation_module {ModulesPath}/mod_negotiation.so

<IfDefine Unixd>
    LoadModule unixd_module {ModulesPath}/mod_unixd.so
</IfDefine>

<IfDefine MpmEvent>
    LoadModule mpm_event_module {ModulesPath}/mod_mpm_event.so
</IfDefine>

<IfDefine Version2.2>
    LoadModule log_config_module {ModulesPath}/mod_log_config.so
    LockFile "{ServerRoot}/accept.lock"
</IfDefine>

<IfDefine Version2.4>
    LoadModule authz_core_module {ModulesPath}/mod_authz_core.so
    Mutex file:{ServerRoot}
</IfDefine>

Listen 0.0.0.0:{Port}
PidFile "{ServerRoot}/httpd.pid"
DocumentRoot "{DocumentRoot}"
TypesConfig {MimeTypes}

<Directory "/">
    Options +FollowSymLinks +MultiViews
    AllowOverride Options FileInfo Indexes
    MultiviewsMatch Any
</Directory>
'''

def build_site(destination, watch):
    '''
    '''
    command = 'jekyll', 'build', '-d', destination
    
    if watch:
        command += ('--watch', )
    
    Popen(command).wait()
    print 'Built to', destination

def write_config(doc_root, root, port):
    ''' Look for Apache modules, write a configuration file.
    
        Return module directory.
    '''
    mod_paths = '/usr/lib/apache2/modules', '/usr/libexec/apache2'
    mime_paths = '/etc/apache2/mime.types', '/etc/mime.types'
    
    mod_path = filter(exists, mod_paths)[0]
    mime_path = filter(exists, mime_paths)[0]

{'fraction_non_alphanumeric': 0.11314285714285714, 'fraction_numerical': 0.0074285714285714285, 'mean_word_length': 4.304545454545455, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3275364', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1142, 'n_words': 268}