<commit_before>#A Collection of commonly used fabric scripts.

import re
from fabric.api import env, local, settings
from fabric.context_managers import hide
from fabric.operations import put, get
import cuisine
from cuisine import run, sudo
from fabric.api import parallel
from random import choice
import string
import socket
import paramiko

# FIXME: select package after detecting appropriate system
cuisine.select_package('apt')

USER_NAME = 'dhilipsiva'


def hello_world():
    run('echo "hello world"')


# vagrant mechine
def vagrant():
    host = '127.0.0.1'
    port = '2222'
    for line in local('vagrant ssh-config', capture=True).split('\n'):
        match = re.search(r'Hostname\s+(\S+)', line)
        if match:
            host = match.group(1)
            continue

        match = re.search(r'User\s+(\S+)', line)
        if match:
            env.user = match.group(1)
            continue

        match = re.search(r'Port\s+(\S+)', line)
        if match:
            port = match.group(1)
            continue

        match = re.search(r'IdentityFile\s(.+)', line)
        if match:
            env.key_filename = match.group(1)
            continue

    env.hosts = ['{0}:{1}'.format(host, port)]


def _prepare():
    sudo('export DEBCONF_TERSE=yes'
        ' DEBIAN_PRIORITY=critical'
        ' DEBIAN_FRONTEND=noninteractive')


def apt(pkg):
    _prepare()
    sudo("apt-get -qqyu install %s" % pkg)


def sync_time():
    with settings(warn_only=True):
        sudo("/etc/init.d/ntp stop")
        sudo("ntpdate pool.ntp.org")
        sudo("/etc/init.d/ntp start")


def setup_time_calibration():
    sudo('apt-get -y install ntp')
    put('config/ntpdate.cron', '%s/' % env.NEWSBLUR_PATH)
    sudo('chmod 755 %s/ntpdate.cron' % env.NEWSBLUR_PATH)<commit_msg>Minor fix for obtaining vagrant keyfile<commit_after>#A Collection of commonly used fabric scripts.

import re
from fabric.api import env, local, settings
from fabric.context_managers import hide
from fabric.operations import put, get
import cuisine
from cuisine import run, sudo
from fabric.api import parallel
from random import choice
import string
import socket
import paramiko

# FIXME: select package after detecting appropriate system
cuisine.select_package('apt')

USER_NAME = 'dhilipsiva'


def hello_world():
    run('echo "hello world"')


# vagrant mechine
def vagrant():
    host = '127.0.0.1'
    port = '2222'
    for line in local('vagrant ssh-config', capture=True).split('\n'):
        match = re.search(r'Hostname\s+(\S+)', line)
        if match:
            host = match.group(1)
            continue

        match = re.search(r'User\s+(\S+)', line)
        if match:
            env.user = match.group(1)
            continue

        match = re.search(r'Port\s+(\S+)', line)
        if match:
            port = match.group(1)
            continue

        match = re.search(r'IdentityFile\s(.+)', line)
        if match:
            env.key_filename = match.group(1).reaplce('"','')
            continue

    env.hosts = ['{0}:{1}'.format(host, port)]


def _prepare():
    sudo('export DEBCONF_TERSE=yes'
        ' DEBIAN_PRIORITY=critical'
        ' DEBIAN_FRONTEND=noninteractive')


def apt(pkg):
    _prepare()
    sudo("apt-get -qqyu install %s" % pkg)


def sync_time():
    with settings(warn_only=True):
        sudo("/etc/init.d/ntp stop")
        sudo("ntpdate pool.ntp.org")
        sudo("/etc/init.d/ntp start")


def setup_time_calibration():
    sudo('apt-get -y install ntp')
    put('config/ntpdate.cron', '%s/' % env.NEWSBLUR_PATH)
    sudo('chmod 755 %s/ntpdate.cron' % env.NEWSBLUR_PATH)
{'fraction_non_alphanumeric': 0.13169519602429597, 'fraction_numerical': 0.010491441192711209, 'mean_word_length': 2.715897435897436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6554587', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1180, 'n_words': 296}