<commit_before>package main

import (
	"github.com/gin-gonic/gin"
	"io/ioutil"
)

var DB = make(map[string]string)

func NewApp() *gin.Engine {

	r := gin.Default()

	r.LoadHTMLGlob("templates/index.tmpl")
  r.Static("/static", "./static")

	r.GET("/", func(c *gin.Context) {
		c.HTML(200, "users/index.tmpl", gin.H{
			"pubTo": "Users",
		})
	})

	r.GET("/slides.md", func(c *gin.Context) {
		body, err := ioutil.ReadFile("initial-slides.md")
		if err != nil {
			panic(err)
		}
    ioutil.WriteFile("slides.md", body, 0644)
		c.String(200, string(body))
	})

	r.PUT("/slides.md", func(c *gin.Context) {
    body, _ := ioutil.ReadAll(c.Request.Body);
    ioutil.WriteFile("slides.md", body, 0644)
		c.String(200, "")
	})

	return r

}

func main() {
	r := NewApp()
	r.Run(":8080")
}<commit_msg>Almost working<commit_after>package main

import (
	"fmt"
	"github.com/atrox/haikunatorgo"
	"github.com/gin-gonic/contrib/sessions"
	"github.com/gin-gonic/gin"
	"io/ioutil"
	"os"
)

func NewApp() *gin.Engine {

	r := gin.Default()

	store := sessions.NewCookieStore([]byte("secret"))
	r.Use(sessions.Sessions("mysession", store))

	r.LoadHTMLGlob("templates/index.tmpl")
	r.Static("/static", "./static")

	r.GET("/", func(c *gin.Context) {
		haikunator := haikunator.NewHaikunator()
		haikunator.TokenLength = 0
		name := haikunator.Haikunate()
		path := fmt.Sprintf("%s.md", name)
		session := sessions.Default(c)
		session.Set("name", path)
		session.Save()
		c.HTML(200, "users/index.tmpl", gin.H{
			"pubTo": path,
		})
	})

	r.GET("/slides.md", func(c *gin.Context) {
		session := sessions.Default(c)
		val := session.Get("name")
		path, ok := val.(string)
		if !ok {
			panic("unlucky")
		}
		if _, err := os.Stat(path); err != nil {
			body, err := ioutil.ReadFile("initial-slides.md")
			if err != nil {
				panic(err)
			}
			ioutil.WriteFile(path, body, 0644)
		}

		body, err := ioutil.ReadFile(path)
		if err != nil {
			panic(err)
		}
		c.String(200, string(body))
	})

	r.PUT("/slides.md", func(c *gin.Context) {
		session := sessions.Default(c)
		val := session.Get("name")
		path, ok := val.(string)
		if !ok {
			panic("unlucky")
		}
		body, _ := ioutil.ReadAll(c.Request.Body)
		ioutil.WriteFile(path, body, 0644)
		c.String(200, "")
	})

	return r

}

func main() {
	r := NewApp()
	r.Run(":8080")
}
{'fraction_non_alphanumeric': 0.20717993079584776, 'fraction_numerical': 0.018598615916955018, 'mean_word_length': 3.5, 'pattern_counts': {'":': 4, '<': 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': '384341', 'n_tokens_mistral': 1070, 'n_tokens_neox': 961, 'n_words': 162}