<commit_before>// Back-end stuff
// Created by <NAME>

// Imports
var express = require('express');
var Promise = require('promise');
var db = require('./db.js');
var client = require('./client.js');

// Create app
var app = express();
app.set('view engine', 'jade');
app.use(express.static('public'));

// Routes

// GET: Get the 20 last values from either temp or load.
app.get('/realtime/:mode', function (req, res) {
    db.realtime(req.params.mode).then(function (result) {
        res.send(result);
    }, function (err) {
        res.send(err);
    });
});

// GET: Get the 20 last average minute temps or loads
app.get('/minute/:mode', function (req, res) {
    db.minute(req.params.mode).then(function (result) {
        res.send(result);
    }, function (err) {
        res.send(err);
    });
});

// GET: Get the 10 last average hour temps or loads
app.get('/hour/:mode', function (req, res) {
    db.hour(req.params.mode).then(function (result) {
        res.send(result);
    }, function (err) {
        res.send(err);
    });
});

// GET: Get the 7 last average day temps or loads
app.get('/day/:mode', function (req, res) {
    db.day(req.params.mode).then(function (result) {
        res.send(result);
    }, function (err) {
        res.send(err);
    });
});

// Regex
var network_re = /([\s\S]+)/;
var network_down_str = "cat /sys/class/net/eth0/statistics/rx_bytes";
var network_up_str = "cat /sys/class/net/eth0/statistics/tx_bytes";
<commit_msg>remove db.shit<commit_after>// Back-end stuff
// Created by <NAME>

// Imports
var express = require('express');
var Promise = require('promise');
var db = require('./db.js');
var client = require('./client.js');

// Create app
var app = express();
app.set('view engine', 'jade');
app.use(express.static('public'));

// Routes

// TEMP/LOAD
app.get('/load', function (req, res) {
    client.getcommand(/(^.*$)/, 'getcpuusage').then(function (result) {
        res.send(result);
    }, function (err) {
        res.send(err);
    });
});

app.get('/temp', function (req, res) {
    client.getcommand(/(^.*$)/, 'getcputemp').then(function (result) {
        res.send(result);
    }, function (err) {
        res.send(err);
    });
});

// Regex
var network_re = /([\s\S]+)/;
var network_down_str = "cat /sys/class/net/eth0/statistics/rx_bytes";
var network_up_str = "cat /sys/class/net/eth0/statistics/tx_bytes";

{'fraction_non_alphanumeric': 0.20142977291841885, 'fraction_numerical': 0.004625735912531539, 'mean_word_length': 3.1017241379310345, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2377717', 'n_tokens_mistral': 824, 'n_tokens_neox': 820, 'n_words': 187}