<commit_before>package main

import (
	"fmt"
	"image"
	_ "image/gif"
	_ "image/jpeg"
	_ "image/png"
	"io/ioutil"
	"log"
	"math"
	"os"
	"path/filepath"
)

func main() {
	files, err := ioutil.ReadDir(".")
	if err != nil {
		log.Fatal(err)
	}

	for _, file := range files {
		name := file.Name()
		if file.IsDir() {
			continue
		}
		switch filepath.Ext(name) {
		case ".jpg", ".jpeg", ".png", ".gif":
		default:
			log.Println("unknown format: ", name)
			continue
		}
		f, err := os.Open(name)
		if err != nil {
			log.Fatalln(err)
		}
		c, _, err := image.DecodeConfig(f)
		if err != nil {
			log.Fatalln(err)
		}
		f.Close()
		if !isLarge(&c) || !is169(&c) {
			continue
		}
		// fmt.Printf("%s%c", name, 0x00)
		fmt.Printf("%q\n", name)
	}
}

func isLarge(c *image.Config) bool {
	return c.Width >= 2560
}
func is169(c *image.Config) bool {
	return (math.Abs(float64(c.Width)/float64(c.Height)) - 1.778) <= 0.1
}<commit_msg>sh/wall-filter - better aspect ratio comparision<commit_after>package main

import (
	"fmt"
	"image"
	_ "image/gif"
	_ "image/jpeg"
	_ "image/png"
	"io/ioutil"
	"log"
	"math"
	"os"
	"path/filepath"
)

func main() {
	files, err := ioutil.ReadDir(".")
	if err != nil {
		log.Fatal(err)
	}

	for _, file := range files {
		name := file.Name()
		if file.IsDir() {
			continue
		}
		switch filepath.Ext(name) {
		case ".jpg", ".jpeg", ".png", ".gif":
		default:
			log.Println("unknown format: ", name)
			continue
		}
		f, err := os.Open(name)
		if err != nil {
			log.Fatalln(err)
		}
		c, _, err := image.DecodeConfig(f)
		if err != nil {
			log.Fatalln(err)
		}
		f.Close()
		if !isLarge(&c) || !is169(&c) {
			continue
		}
		// fmt.Printf("%s%c", name, 0x00)
		fmt.Printf("%q\n", name)
	}
}

func isLarge(c *image.Config) bool {
	return c.Width >= 2560
}
func is169(c *image.Config) bool {
	return (math.Abs(float64(c.Width)/float64(c.Height) - 1.778)) <= 0.1
}
{'fraction_non_alphanumeric': 0.1997880233174351, 'fraction_numerical': 0.024377318494965553, 'mean_word_length': 2.941544885177453, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, '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': '7202862', 'n_tokens_mistral': 913, 'n_tokens_neox': 815, 'n_words': 168}