<commit_before>package main

import "bufio"
import "fmt"
import "net"
import "os"

func checkError(e error) {
  if e != nil {
    panic(e)
  }
}

func main() {
  l, err := net.Listen("tcp", ":17")
  checkError(err)
  defer l.Close()
  fmt.Println("port connected")

  f, err := os.Open("quotes")
  checkError(err)
  defer f.Close()

  var quotes []string
  quotes = make([]string, 0, 5)
  s := bufio.NewScanner(bufio.NewReader(f))

  for s.Scan() {
    quotes = append(quotes, s.Text())
  }
  fmt.Println("quotes loaded; count =", len(quotes))

  fmt.Println("server started")

  for {
    c, err := l.Accept()
    if err != nil {
      panic(err)
    }
    fmt.Println("connection made ...")
    c.Write([]byte(quotes[0]))
    c.Close()
    fmt.Println("connection closed ...")
  }
}<commit_msg>select a random quote from the quotes file<commit_after>package main

import "bufio"
import "fmt"
import "net"
import "os"
import "math/rand"

func checkError(e error) {
  if e != nil {
    panic(e)
  }
}

func main() {
  l, err := net.Listen("tcp", ":17")
  checkError(err)
  defer l.Close()
  fmt.Println("port connected")

  f, err := os.Open("quotes")
  checkError(err)
  defer f.Close()

  var quotes []string
  quotes = make([]string, 0, 5)
  s := bufio.NewScanner(bufio.NewReader(f))

  for s.Scan() {
    quotes = append(quotes, s.Text())
  }
  fmt.Println("quotes loaded; count =", len(quotes))

  fmt.Println("server started")

  for {
    c, err := l.Accept()
    checkError(err)

    // select a random quote; a quote of the moment, instead of the day
    q := quotes[rand.Intn(len(quotes))]
    // write the quote to the connection
    c.Write([]byte(q))
    c.Close()
  }
}
{'fraction_non_alphanumeric': 0.1711229946524064, 'fraction_numerical': 0.0053475935828877, 'mean_word_length': 3.097323600973236, 'pattern_counts': {'":': 2, '<': 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': '6561480', 'n_tokens_mistral': 644, 'n_tokens_neox': 623, 'n_words': 159}