<commit_before>package main

import (
	"flag"
	"fmt"
	"github.com/hanwen/termite/termite"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"path/filepath"
)

func serveBin(name string) func(w http.ResponseWriter, req *http.Request) {
	return func(w http.ResponseWriter, req *http.Request) {
		me, _ := os.Readlink("/proc/self/exe")
		d, _ := filepath.Split(me)

		for _, n := range []string{
			filepath.Join(d, name),
			filepath.Join(d, fmt.Sprintf("../%s/%s", name, name)),
		} {
			if fi, _ := os.Lstat(n); fi != nil && !fi.IsDir() {
				http.ServeFile(w, req, n)
			}
		}
	}
}

func main() {
	port := flag.Int("port", 1233, "Where to listen for work requests.")
	secretFile := flag.String("secret", "secret.txt", "file containing password.")
	flag.Parse()
	log.SetPrefix("C")

	secret, err := ioutil.ReadFile(*secretFile)
	if err != nil {
		log.Fatal("ReadFile", err)
	}

	c := termite.NewCoordinator(secret)
	c.Mux.HandleFunc("/bin/worker", serveBin("worker"))
	c.Mux.HandleFunc("/bin/shell-wrapper", serveBin("shell-wrapper"))
<commit_msg>Run coordinator on 1230 by default.<commit_after>package main

import (
	"flag"
	"fmt"
	"github.com/hanwen/termite/termite"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"path/filepath"
)

func serveBin(name string) func(w http.ResponseWriter, req *http.Request) {
	return func(w http.ResponseWriter, req *http.Request) {
		me, _ := os.Readlink("/proc/self/exe")
		d, _ := filepath.Split(me)

		for _, n := range []string{
			filepath.Join(d, name),
			filepath.Join(d, fmt.Sprintf("../%s/%s", name, name)),
		} {
			if fi, _ := os.Lstat(n); fi != nil && !fi.IsDir() {
				http.ServeFile(w, req, n)
			}
		}
	}
}

func main() {
	port := flag.Int("port", 1230, "Where to listen for work requests.")
	secretFile := flag.String("secret", "secret.txt", "file containing password.")
	flag.Parse()
	log.SetPrefix("C")

	secret, err := ioutil.ReadFile(*secretFile)
	if err != nil {
		log.Fatal("ReadFile", err)
	}

	c := termite.NewCoordinator(secret)
	c.Mux.HandleFunc("/bin/worker", serveBin("worker"))
	c.Mux.HandleFunc("/bin/shell-wrapper", serveBin("shell-wrapper"))

{'fraction_non_alphanumeric': 0.19627507163323782, 'fraction_numerical': 0.0057306590257879654, 'mean_word_length': 3.9527186761229314, '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': '4517369', 'n_tokens_mistral': 865, 'n_tokens_neox': 810, 'n_words': 163}