<commit_before>package main

import "github.com/skip2/go-qrcode"

func main() {
	qrCode, error := qrcode.New("http://www.twitter.com/dvlc_", qrcode.Medium)
	if error != nil {
		panic(error)
	}
	qrCode.WriteFile(250, "test.png")
}<commit_msg>Created endpoint to generate qrcode<commit_after>package main

import (
	"github.com/skip2/go-qrcode"
	"gopkg.in/gin-gonic/gin.v1"
	"gopkg.in/gin-gonic/gin.v1/render"
)

func main() {
	r := gin.Default()

	r.POST("/qrcode", func(context *gin.Context) {
		url := context.PostForm("url")
		qrcode, error := generateQrCode(url)
		if error != nil {
			panic(error)
		}

		bytes, error := qrcode.PNG(256)
		if error != nil {
			panic(error)
		}

		context.Render(200, render.Data{ContentType: "image/png", Data: bytes})
	})

	r.Run()
}

func generateQrCode(url string) (*qrcode.QRCode, error) {
	qrcode, error := qrcode.New(url, qrcode.Medium)
	if error != nil {
		return nil, error
	}

	return qrcode, error
}
{'fraction_non_alphanumeric': 0.16807610993657504, 'fraction_numerical': 0.013742071881606765, 'mean_word_length': 3.9322916666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '3028282', 'n_tokens_mistral': 419, 'n_tokens_neox': 379, 'n_words': 73}