<commit_before><commit_msg>feature(status) mv to bin<commit_after>(function(){
    'use strict';
    
    var http        = require('http'),
        path        = require('path'),
        express     = require('express'),
        mime        = require('mime'),
        utilIO      = require('util-io'),
        pipeIO      = require('pipe-io'),
        
        PORT        = 4321,
        OK          = 200,
        MOVED       = [301, 302],
        app         = express(),
        DIR         = path.normalize(__dirname + '/../img/'),
        EXT         = '.png',
        OK_IMG      = DIR + 'ok'    + EXT,
        ERROR_IMG   = DIR + 'error' + EXT,
        MOVED_IMG   = DIR + 'moved' + EXT,
        TYPE        = mime.lookup(OK_IMG),
        TWO_SECONDS = 2000;
    
    http.createServer(app).listen(PORT);
    
    console.log('server: ' + PORT + '\npid: ' + process.pid);
    
    app.use('/', express.static(__dirname));
    
    app.get('/', function(req, res) {
        sendFile(res, 'README.md', console.log.bind(console));
    });
    
    app.get('/host/*', function(request, response) {
        var host = 'http://' + request.params[0],
            sended;
        
        console.log(request.params);
        
        if (host) {
            response.contentType(TYPE);
            
            setTimeout(function() {
                sended = true;
                sendFile(response, MOVED_IMG);
            }, TWO_SECONDS);
            
            http.get(host, function(res) {
                var status = res.statusCode;
                
                console.log(status);
                if (!sended)
                    if (status === OK)
                        sendFile(response, OK_IMG);
                    else if(status === MOVED[0] || status === MOVED[1])
                        sendFile(response, MOVED_IMG);
                    else
                        sendFile(response, ERROR_IMG);
                
                sended = true;
            }).on('error', function() {
                response.contentType(TYPE);
                sendFile(response, ERROR_IMG);
            });
        } else
            response.send('/:host');
    });
    
    function sendFile(res, name, callback) {
        pipeIO.create(name, res, function(error) {
            if (error)
                res.send(error, 404);
            else
                utilIO.exec(callback, name);
        });
    }
})();
{'fraction_non_alphanumeric': 0.13673805601317957, 'fraction_numerical': 0.009472817133443162, 'mean_word_length': 1.2407749077490775, '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': '3463685', 'n_tokens_mistral': 716, 'n_tokens_neox': 681, 'n_words': 126}