<commit_before>'use strict'

let express = require('express');
let multer  = require('multer');
let router = express.Router();
let upload = multer();

var lastMove = {
  dir: "stop",
  speed: 0
}

var resetAt = Date()
let resetAfterSec = 5;

router.get('/move', (req, res) => {
  let dir = req.query.dir
  let speed = req.query.speed
  res.send('You moved ' + speed + ' meters ' + dir);
  lastMove = {
    dir: dir,
    speed: speed
  }
  resetAt = new Date((new Date()).getTime() + resetAfterSec * 1000);

  // Autoreset
  setTimeout(() => {
    if ((new Date()).getTime() > resetAt.getTime()) {
      lastMove = {
        dir: "stop",
        speed: 0
      }
    }
  }, resetAfterSec * 1000 + 200);
});

router.get('/getmove', (req, res) => {
  res.json(lastMove);
})

var imgbuffer = new Buffer([]);

router.post('/img', upload.single('file'), (req,res) => {
  imgbuffer = req.file.buffer;
  res.send('1');
})

router.get('/img', (req, res) => {
  res.type('jpeg');
  res.set('Cache-Control', 'no-store');
  res.send(imgbuffer);
})

module.exports = router
<commit_msg>api changes<commit_after>'use strict'

let express = require('express');
let multer  = require('multer');
let router = express.Router();
let upload = multer();

var lastMove = {
  // direction vector { [0,360), [0,1] }
  dir: [0,0],
  vertical: 0
}

var resetAt = Date()
let resetAfterSec = 5;

router.get('/move', (req, res) => {
  let dir = req.query.dir
  let vertical = req.query.vertical
  res.send('You moved ' + speed + ' meters ' + dir);
  lastMove = {
    dir: dir,
    vertical: vertical
  }
  resetAt = new Date((new Date()).getTime() + resetAfterSec * 1000);

  // Autoreset
  setTimeout(() => {
    if ((new Date()).getTime() > resetAt.getTime()) {
      lastMove = {
        dir: [0,0],
        vertical: 0
      }
    }
  }, resetAfterSec * 1000 + 200);
});

router.get('/getmove', (req, res) => {
  res.json(lastMove);
})

var imgbuffer = new Buffer([]);

router.post('/img', upload.single('file'), (req,res) => {
  imgbuffer = req.file.buffer;
  res.send('1');
})

router.get('/img', (req, res) => {
  res.type('jpeg');
  res.set('Cache-Control', 'no-store');
  res.send(imgbuffer);
})

module.exports = router

{'fraction_non_alphanumeric': 0.20399818264425262, 'fraction_numerical': 0.01817355747387551, 'mean_word_length': 3.178368121442125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1250364', 'n_tokens_mistral': 817, 'n_tokens_neox': 784, 'n_words': 181}