<commit_before>#!/usr/bin/env node

###
  Module dependencies.
###
require('source-map-support').install()
app = require '../app'
debug = require('debug')('sisetv:server')
http = require 'http'
chalk = require 'chalk'

###
    Normalize a port into a number, string, or false.
###

normalizePort = (val) ->
  port = parseInt val, 10
  return val if isNaN port
  return port if port >= 0
  false

###
  Get port from environment and store in Express.
###

port = normalizePort process.env.PORT or '3000'
app.set 'port', port

###
  Create HTTP server.
###

server = http.createServer app

###
  Event listener for HTTP server "error" event.
###

onError = (error) ->
  if error.syscall != 'listen'
    throw error;
  switch error.code
    when 'EACCES'
      console.error chalk.red "#{bind} requires elevated privileges"
      process.exit 1
    when 'EADDRINUSE'
      console.error chalk.red "#{bind} is already in use"
      process.exit 1
    else
      throw error

###
  Event listener for HTTP server "listening" event.
###

onListening = () ->
  addr = server.address();
  bind = if typeof addr == 'string' then "pipe #{addr}" else "port #{addr.port}";
  debug('Listening on ' + bind);

###
  Listen on provided port, on all network interfaces.
###

server.listen port
server.on 'error', onError
server.on 'listening', onListening

bind = if typeof port == 'string' then "Pipe #{port}" else "Port #{port}"

console.log chalk.cyan 'SiseTV is now running'
console.log chalk.cyan "Visit #{chalk.magenta 'http://localhost:' + app.get 'port'} to see it"



<commit_msg>Add /admin to first time startup message URL<commit_after>#!/usr/bin/env node

###
  Module dependencies.
###
require('source-map-support').install()
app = require '../app'
debug = require('debug')('sisetv:server')
http = require 'http'
chalk = require 'chalk'

###
    Normalize a port into a number, string, or false.
###

normalizePort = (val) ->
  port = parseInt val, 10
  return val if isNaN port
  return port if port >= 0
  false

###
  Get port from environment and store in Express.
###

port = normalizePort process.env.PORT or '3000'
app.set 'port', port

###
  Create HTTP server.
###

server = http.createServer app

###
  Event listener for HTTP server "error" event.
###

onError = (error) ->
  if error.syscall != 'listen'
    throw error;
  switch error.code
    when 'EACCES'
      console.error chalk.red "#{bind} requires elevated privileges"
      process.exit 1
    when 'EADDRINUSE'
      console.error chalk.red "#{bind} is already in use"
      process.exit 1
    else
      throw error

###
  Event listener for HTTP server "listening" event.
###

onListening = () ->
  addr = server.address();
  bind = if typeof addr == 'string' then "pipe #{addr}" else "port #{addr.port}";
  debug('Listening on ' + bind);

###
  Listen on provided port, on all network interfaces.
###

server.listen port
server.on 'error', onError
server.on 'listening', onListening

bind = if typeof port == 'string' then "Pipe #{port}" else "Port #{port}"

console.log chalk.cyan 'SiseTV is now running'
console.log chalk.cyan "Visit #{chalk.magenta 'http://localhost:' + app.get 'port'}/admin to see it"




{'fraction_non_alphanumeric': 0.14272241433511473, 'fraction_numerical': 0.005658597925180761, 'mean_word_length': 3.4691011235955056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3339874', 'n_tokens_mistral': 1045, 'n_tokens_neox': 1003, 'n_words': 349}