<commit_before>/*
 Begin by
*/

package main

import (
	"fmt"
	"net/http"
	"os/exec"
	"time"
)

func main() {

	// Start opening the browser, pointed at the application
	openUI()

	// The webserver has to run on the main go thread, or the program will
	// reach the end and quit. Nothing else will happen until this func returns
	startServer()

}

func startServer() {
	http.HandleFunc("/", uiCall)
	err := http.ListenAndServe(":12415", nil)
	if err != nil {
		fmt.Println(err)
	}
}

func uiCall(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Hello from your favorite application")
}

func openUI() {
	time.Sleep(1 * time.Second)
	var cmd = exec.Command("open", "http://localhost:12415/")
	err := cmd.Run()
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println("Growing a head")
	}
}<commit_msg>Altered code to use it as a library<commit_after>/*
 Begin by opening a browser, and point it at localhost.
 Then, very quickly, start an http listener.
*/

package webhead

import (
	"net/http"
	"os/exec"
)

func Start() error {

	// Start opening the browser, pointed at the application
	err := openUI()
	if err != nil {
		return err
	}

	// The webserver has to run on the main go thread, or the program will
	// reach the end and quit. Nothing else will happen until this func returns
	err = startServer()
	return err

}

func startServer() error {
	err := http.ListenAndServe(":12415", nil)
	return err
}

func openUI() error {
	var cmd = exec.Command("open", "http://localhost:12415/")
	err := cmd.Run()
	return err
}
{'fraction_non_alphanumeric': 0.12955729166666666, 'fraction_numerical': 0.013671875, 'mean_word_length': 3.5073313782991202, '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': '5332484', 'n_tokens_mistral': 548, 'n_tokens_neox': 523, 'n_words': 187}