<commit_before><?php

ini_set('max_execution_time', 60);

$config = json_decode(file_get_contents('../config.json'), 1);

function setpanspeed($panspeed) {
    global $config;
    
    $url = 'http://' . $config['ip'] . '/cgi-bin/camctrl.cgi?speedpan=' + $panspeed;
    $curl = curl_init($url);
    curl_exec($curl);
}

function takepicture($stamp, $num) {
    global $config;
    
    $url = 'http://' . $config['ip'] . '/cgi-bin/video.jpg';
    $folder = '../pics/' . date_format($stamp, 'Y/m/d/H');
    if (!is_dir($folder)) {
        mkdir($folder, 0777, true);
    }
    $img = $folder . '/' . date_format($stamp, 'i') . '-' . $num . '.jpg';
    file_put_contents($img, file_get_contents($url));
}

function rotatehome() {
    global $config;
    
    $url = 'http://' . $config['ip'] . '/cgi-bin/camctrl.cgi?move=home';
    $curl = curl_init($url);
    curl_exec($curl);
    
    sleep(5);
}

function rotatecamera($direction) {
    global $config;
    
    $dir = 'right';
    if ($direction > 0) {
        $dir = 'left';
    }
    
    for ($i = 0; $i < abs($direction) * 2; $i++) {
        $url = 'http://' . $config['ip'] . '/cgi-bin/camctrl.cgi?move=' . $dir;
        $curl = curl_init($url);
        curl_exec($curl);
    }
    
    sleep(abs($direction));
}

date_default_timezone_set('Europe/Zurich');

$current = date_create();

rotatehome();
rotatecamera(6);
for ($i = 1; $i < 7; $i++) {
    takepicture($current, $i);
    rotatecamera(-1);
    sleep(1);
}
rotatehome();<commit_msg>new startswith-function<commit_after><?php

ini_set('max_execution_time', 60);

$config = json_decode(file_get_contents('../config.json'), 1);

function setpanspeed($panspeed) {
    global $config;
    
    $url = 'http://' . $config['ip'] . '/cgi-bin/camctrl.cgi?speedpan=' + $panspeed;
    $curl = curl_init($url);
    curl_exec($curl);
}

function takepicture($stamp, $num) {
    global $config;
    
    $url = 'http://' . $config['ip'] . '/cgi-bin/video.jpg';
    $folder = '../pics/' . date_format($stamp, 'Y/m/d/H');
    if (!is_dir($folder)) {
        mkdir($folder, 0777, true);
    }
    $img = $folder . '/' . date_format($stamp, 'i') . '-' . $num . '.jpg';
    file_put_contents($img, file_get_contents($url));
}

function rotatehome() {
    global $config;
    
    $url = 'http://' . $config['ip'] . '/cgi-bin/camctrl.cgi?move=home';
    $curl = curl_init($url);
    curl_exec($curl);
    
    sleep(5);
}

function rotatecamera($direction) {
    global $config;
    
    $dir = 'right';
    if ($direction > 0) {
        $dir = 'left';
    }
    
    for ($i = 0; $i < abs($direction) * 2; $i++) {
        $url = 'http://' . $config['ip'] . '/cgi-bin/camctrl.cgi?move=' . $dir;
        $curl = curl_init($url);
        curl_exec($curl);
    }
    
    sleep(abs($direction));
}

function startsWith($haystack, $needle) {
    return $needle === "" || strpos($haystack, $needle) === 0;
}

date_default_timezone_set('Europe/Zurich');

$current = date_create();

rotatehome();
rotatecamera(6);
for ($i = 1; $i < 7; $i++) {
    takepicture($current, $i);
    rotatecamera(-1);
    sleep(1);
}
rotatehome();
{'fraction_non_alphanumeric': 0.2212588310854207, 'fraction_numerical': 0.010597302504816955, 'mean_word_length': 2.845679012345679, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '1161974', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1173, 'n_words': 206}