<commit_before>package main

// go run client.go -f ~/skypi/sbs1.out
// go run client.go -h skypi:30003


import (
	"bufio"
	//"fmt"	
	"flag"
	"io"
	"log"
	"net"
	"os"
	//"time"
	
	"github.com/skypies/adsb"
	"pi/tracktable"  /// This is screwed up
)

var Log *log.Logger

var fHostPort string
var fFilename string
var fDumpPos  bool

func init() {
	flag.StringVar(&fHostPort, "h", "", "host:port of dump1090:30003")
	flag.StringVar(&fFilename, "f", "", "sbs formatted CSV file thing to read")
	flag.BoolVar  (&fDumpPos,  "pos", false, "just dump out positions")
	flag.Parse()
	
	Log = log.New(os.Stdout,"", log.Ldate|log.Ltime)//|log.Lshortfile)
}

func getIoReader() io.Reader {
	if fFilename != "" {
		if osFile, err := os.Open(fFilename); err != nil {
			panic(err)
		} else {
			Log.Printf("reading file '%s' (dumpPos=%v)", fFilename, fDumpPos)
			return osFile
		}
	} else if fHostPort != "" {
		if conn,err := net.Dial("tcp", fHostPort); err != nil {
			panic(err)
		} else {
			Log.Printf("connecting to '%s' (dumpPos=%v)", fHostPort, fDumpPos)
			return conn // a net.Conn implements io.Reader
			// status, err := bufio.NewReader(conn).ReadString('\n')
		}

	} else {
		panic("No inputs defined")
	}
}

var kSweepAfter = 100

func main() {
	scanner := bufio.NewScanner(getIoReader())

	table := tracktable.New()
	table.WaitTime = 10 // If a given transponder goes quiet for 3000, ship the track
	
	// Main goroutine: read input, add it to the TrackTable
	i := 1
	for scanner.Scan() {
		m := adsb.Msg{}
		text := scanner.Text()
		if err := m.FromSBS1(text); err != nil {
			Log.Fatal(err)
			continue
		}
		//Log.Printf("   --- %s\n", text)
		table.AddMessage(&m)
		if (i % kSweepAfter) == 0 { table.Sweep() }
		i++<commit_msg>Change publish timeout (too many frags)<commit_after>package main

// go run client.go -f ~/skypi/sbs1.out
// go run client.go -h skypi:30003


import (
	"bufio"
	//"fmt"	
	"flag"
	"io"
	"log"
	"net"
	"os"
	//"time"
	
	"github.com/skypies/adsb"
	"pi/tracktable"  /// This is screwed up
)

var Log *log.Logger

var fHostPort string
var fFilename string
var fDumpPos  bool

func init() {
	flag.StringVar(&fHostPort, "h", "", "host:port of dump1090:30003")
	flag.StringVar(&fFilename, "f", "", "sbs formatted CSV file thing to read")
	flag.BoolVar  (&fDumpPos,  "pos", false, "just dump out positions")
	flag.Parse()
	
	Log = log.New(os.Stdout,"", log.Ldate|log.Ltime)//|log.Lshortfile)
}

func getIoReader() io.Reader {
	if fFilename != "" {
		if osFile, err := os.Open(fFilename); err != nil {
			panic(err)
		} else {
			Log.Printf("reading file '%s' (dumpPos=%v)", fFilename, fDumpPos)
			return osFile
		}
	} else if fHostPort != "" {
		if conn,err := net.Dial("tcp", fHostPort); err != nil {
			panic(err)
		} else {
			Log.Printf("connecting to '%s' (dumpPos=%v)", fHostPort, fDumpPos)
			return conn // a net.Conn implements io.Reader
			// status, err := bufio.NewReader(conn).ReadString('\n')
		}

	} else {
		panic("No inputs defined")
	}
}

var kSweepAfter = 100

func main() {
	scanner := bufio.NewScanner(getIoReader())

	table := tracktable.New()
	table.WaitTime = 300 // If a given transponder goes quiet for 3000, ship the track
	
	// Main goroutine: read input, add it to the TrackTable
	i := 1
	for scanner.Scan() {
		m := adsb.Msg{}
		text := scanner.Text()
		if err := m.FromSBS1(text); err != nil {
			Log.Fatal(err)
			continue
		}
		//Log.Printf("   --- %s\n", text)
		table.AddMessage(&m)
		if (i % kSweepAfter) == 0 { table.Sweep() }
		i++
{'fraction_non_alphanumeric': 0.17157563625965114, 'fraction_numerical': 0.015727766657134688, 'mean_word_length': 3.286764705882353, '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': '7162377', 'n_tokens_mistral': 1496, 'n_tokens_neox': 1361, 'n_words': 352}