<commit_before>package qrc

import (
	"code.google.com/p/rsc/qr"
	"fmt"
	"io"
)

func PrintSixel(w io.Writer, code *qr.Code, inverse bool) {
	black := "0"
	white := "1"

	fmt.Fprint(w,
		"\x1BPq",
		"#", black, ";2;0;0;0",
		"#", white, ";2;100;100;100",
	)

	if inverse {
		black, white = white, black
	}

	line := "#" + white + "!" + fmt.Sprintf("%d", (code.Size+2)*6) + "~"
	fmt.Fprint(w, line, "-")

	for x := 0; x < code.Size; x++ {
		fmt.Fprint(w, "#", white)
		color := white
		run := 6
		var current string
		for y := 0; y < code.Size; y++ {
			if code.Black(x, y) {
				current = black
			} else {
				current = white
			}
			if current != color {
				fmt.Fprint(w, "#", color, "!", run, "~")
				color = current
				run = 0
			}
			run += 6
		}
		if color == white {
			fmt.Fprintf(w, "#%s!%d~", white, run+6)
		} else {
			fmt.Fprintf(w, "#%s!%d~#%s!6~", color, run, white)
		}
		fmt.Fprint(w, "-")
	}
	fmt.Fprint(w, line)<commit_msg>Sixel: Fix mirrored and rotated image<commit_after>package qrc

import (
	"code.google.com/p/rsc/qr"
	"fmt"
	"io"
)

func PrintSixel(w io.Writer, code *qr.Code, inverse bool) {
	black := "0"
	white := "1"

	fmt.Fprint(w,
		"\x1BPq",
		"#", black, ";2;0;0;0",
		"#", white, ";2;100;100;100",
	)

	if inverse {
		black, white = white, black
	}

	line := "#" + white + "!" + fmt.Sprintf("%d", (code.Size+2)*6) + "~"
	fmt.Fprint(w, line, "-")

	for y := 0; y < code.Size; y++ {
		fmt.Fprint(w, "#", white)
		color := white
		run := 6
		var current string
		for x := 0; x < code.Size; x++ {
			if code.Black(x, y) {
				current = black
			} else {
				current = white
			}
			if current != color {
				fmt.Fprint(w, "#", color, "!", run, "~")
				color = current
				run = 0
			}
			run += 6
		}
		if color == white {
			fmt.Fprintf(w, "#%s!%d~", white, run+6)
		} else {
			fmt.Fprintf(w, "#%s!%d~#%s!6~", color, run, white)
		}
		fmt.Fprint(w, "-")
	}
	fmt.Fprint(w, line)
{'fraction_non_alphanumeric': 0.2304075235109718, 'fraction_numerical': 0.027168234064785787, 'mean_word_length': 2.6685823754789273, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6219706', 'n_tokens_mistral': 981, 'n_tokens_neox': 847, 'n_words': 188}