<commit_before>package matrix

import (
	"fmt"
	zmq "github.com/pebbe/zmq4"
	"time"
)

type matrix struct {
	socket        *zmq.Socket
	context       *zmq.Context
	bitmap        [][][3]byte
	flame_buffer  [][]byte
	flame_palette [][3]byte
	rows          int
	columns       int
}

func Init(host string, rows int, columns int) *matrix {
	var matrix = matrix{
		rows:    rows,
		columns: columns,
	}
	context, err := zmq.NewContext()
	if err != nil {
		panic(err)
	}
	matrix.context = context
	socket, err := matrix.context.NewSocket(zmq.PUSH)
	if err != nil {
		panic(err)
	}
	matrix.socket = socket
	matrix.socket.SetImmediate(true)
	matrix.socket.SetSndhwm(1)
	matrix.socket.SetLinger(1 * time.Second)
	if err := matrix.socket.Connect(host); err != nil {
		panic(err)
	}
	matrix.bitmap = make([][][3]byte, rows)
	for r, _ := range matrix.bitmap {
		matrix.bitmap[r] = make([][3]byte, columns)
	}

	return &matrix
}

func (matrix *matrix) Send() {
	var data []byte
	for _, row := range matrix.bitmap {
		for _, b := range row {
			data = append(data, b[0], b[1], b[2])
		}
	}
	fmt.Printf("Sending %d bytes\n", len(data))
	if _, err := matrix.socket.SendMessage(data, nil); err != nil {
		panic(err)<commit_msg>Remove debug print<commit_after>package matrix

import (
	zmq "github.com/pebbe/zmq4"
	"time"
)

type matrix struct {
	socket        *zmq.Socket
	context       *zmq.Context
	bitmap        [][][3]byte
	flame_buffer  [][]byte
	flame_palette [][3]byte
	rows          int
	columns       int
}

func Init(host string, rows int, columns int) *matrix {
	var matrix = matrix{
		rows:    rows,
		columns: columns,
	}
	context, err := zmq.NewContext()
	if err != nil {
		panic(err)
	}
	matrix.context = context
	socket, err := matrix.context.NewSocket(zmq.PUSH)
	if err != nil {
		panic(err)
	}
	matrix.socket = socket
	matrix.socket.SetImmediate(true)
	matrix.socket.SetSndhwm(1)
	matrix.socket.SetLinger(1 * time.Second)
	if err := matrix.socket.Connect(host); err != nil {
		panic(err)
	}
	matrix.bitmap = make([][][3]byte, rows)
	for r, _ := range matrix.bitmap {
		matrix.bitmap[r] = make([][3]byte, columns)
	}

	return &matrix
}

func (matrix *matrix) Send() {
	var data []byte
	for _, row := range matrix.bitmap {
		for _, b := range row {
			data = append(data, b[0], b[1], b[2])
		}
	}
	if _, err := matrix.socket.SendMessage(data, nil); err != nil {
		panic(err)
{'fraction_non_alphanumeric': 0.15423514538558786, 'fraction_numerical': 0.008428150021070375, 'mean_word_length': 3.300724637681159, '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': '6369548', 'n_tokens_mistral': 924, 'n_tokens_neox': 907, 'n_words': 216}