<commit_before>package main

import (
	"flag"
	"fmt"
	"net/http"
	"os"
)

func main() {

	flags := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
	username := flags.String("username", "", "Username for concourse")
	password := flags.String("password", "", "<PASSWORD>")
	url := flags.String("url", "", "base url for concourse")
	pipeline := flags.String("pipeline", "", "pipeline for concourse")
	job := flags.String("job", "", "job for concourse")
	flags.Parse(os.Args[1:])

	fmt.Println("raspberryfly airbourne")

	endpoint := *url + "/pipelines/" + *pipeline + "/jobs/" + *job + "/builds"
	req, err := http.NewRequest("POST", endpoint, nil)
	if err != nil {
		fmt.Printf("%v", err)
	}

	req.SetBasicAuth(*username, *password)
	client := &http.Client{}
	resp, err := client.Do(req)

	if err != nil {
		fmt.Printf("%v", err)
	}

	fmt.Printf("resp: %v\n", resp)
}
<commit_msg>Trigger build when all 3 switches on<commit_after>package main

import (
	"flag"
	"fmt"
	"net/http"
	"os"
	"time"

	"github.com/stianeikeland/go-rpio"
)

var currentState bool

func main() {

	flags := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
	username := flags.String("username", "", "Username for concourse")
	password := flags.String("password", "", "<PASSWORD>")
	url := flags.String("url", "", "base url for concourse")
	pipeline := flags.String("pipeline", "", "pipeline for concourse")
	job := flags.String("job", "", "job for concourse")
	flags.Parse(os.Args[1:])

	fmt.Println("raspberryfly airbourne")

	if err := rpio.Open(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	pin14 := rpio.Pin(14)
	pin15 := rpio.Pin(15)
	pin18 := rpio.Pin(18)

	// Unmap gpio memory when done
	defer rpio.Close()

	pin14.Input()
	pin14.PullDown()

	pin15.Input()
	pin15.PullDown()

	pin18.Input()
	pin18.PullDown()

	for {
		res14 := pin14.Read()
		res15 := pin15.Read()
		res18 := pin18.Read()
		// fmt.Printf("pin 14: %v, pin 15: %v, pin 18:%v\n", res14, res15, res18)

		state := res14 == 1 && res15 == 1 && res18 == 1
		if shouldTrigger(state) {
			trigger(url, username, password, pipeline, job)
		}

		time.Sleep(50 * time.Millisecond)
	}
}

func shouldTrigger(newState bool) bool {
	if currentState {
		currentState = newState
		return false
	}

	currentState = newState
	return newState
}

func trigger(url, username, password, pipeline, job *string) {
	endpoint := *url + "/pipelines/" + *pipeline + "/jobs/" + *job + "/builds"
	req, err := http.NewRequest("POST", endpoint, nil)
	if err != nil {
		fmt.Printf("%v", err)
	}

	req.SetBasicAuth(*username, *password)
	client := &http.Client{}
	resp, err := client.Do(req)

	if err != nil {
		fmt.Printf("%v", err)
	}

	fmt.Printf("resp: %v\n", resp)
}

{'fraction_non_alphanumeric': 0.19225037257824143, 'fraction_numerical': 0.02421758569299553, 'mean_word_length': 4.037523452157599, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5402927', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1006, 'n_words': 234}