<commit_before>package main

import (
	"io/ioutil"
	"net/http"
)

func check(e error) {
	if e != nil {
		panic(e)
	}
}

func pasteHandler(w http.ResponseWriter, req *http.Request) {
	buf, _ := ioutil.ReadAll(req.Body)
	paste := buf[89 : len(buf)-46]
	err := ioutil.WriteFile("/tmp/dat1", paste, 0644)
	check(err)
}

func main() {
	http.HandleFunc("/", pasteHandler)
	http.ListenAndServe(":8080", nil)

}<commit_msg>Fix up minor bugs and add more features<commit_after>package main

import (
	"fmt"
	"github.com/dchest/uniuri"
	"io/ioutil"
	"net/http"
	"os"
)

func check(e error) {
	if e != nil {
		panic(e)
	}
}

func exists(location string) bool {
	if _, err := os.Stat(location); err != nil {
		if os.IsNotExist(err) {
			return false
		}
	}
	return true

}

func generateName() string {
	s := uniuri.NewLen(4)
	return s

}
func save(buf []byte) string {
	paste := buf[92 : len(buf)-46]
	address := "localhost:8080/p/"

	dir := "/tmp/"
	s := generateName()
	loc := dir + s

	err := ioutil.WriteFile(loc, paste, 0644)
	check(err)

	url := address + s
	return url
}

func pasteHandler(w http.ResponseWriter, req *http.Request) {
	buf, _ := ioutil.ReadAll(req.Body)
	fmt.Fprintf(w, save(buf))
}

func main() {
	http.HandleFunc("/", pasteHandler)
	http.Handle("/p/", http.StripPrefix("/p/", http.FileServer(http.Dir("/tmp"))))

	http.ListenAndServe(":8080", nil)

}
{'fraction_non_alphanumeric': 0.17888563049853373, 'fraction_numerical': 0.021994134897360705, 'mean_word_length': 3.8404255319148937, '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': '7157568', 'n_tokens_mistral': 585, 'n_tokens_neox': 552, 'n_words': 121}