Have cursor cook some shit up
I cbaaaaaaaaaaa..
This commit is contained in:
49
main.go
49
main.go
@@ -7,6 +7,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
@@ -78,10 +79,56 @@ func main() {
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
// Create a map to store raw extension names and their binary vs text counts
|
||||
extensionBinaryTextCount := make(map[string][2]int)
|
||||
|
||||
// Collect all raw extensions and their counts
|
||||
extensionTypeCount.Range(func(key, value any) bool {
|
||||
log.Printf("Extension: %s, Count: %d", key, value.(int))
|
||||
keyStr := key.(string)
|
||||
count := value.(int)
|
||||
|
||||
// Check if it's a text file (has " (text)" suffix)
|
||||
if strings.HasSuffix(keyStr, " (text)") {
|
||||
baseExt := strings.TrimSuffix(keyStr, " (text)")
|
||||
counts, exists := extensionBinaryTextCount[baseExt]
|
||||
if !exists {
|
||||
counts = [2]int{0, 0}
|
||||
}
|
||||
counts[1] = count // index 1 for text count
|
||||
extensionBinaryTextCount[baseExt] = counts
|
||||
} else {
|
||||
// Binary file
|
||||
counts, exists := extensionBinaryTextCount[keyStr]
|
||||
if !exists {
|
||||
counts = [2]int{0, 0}
|
||||
}
|
||||
counts[0] = count // index 0 for binary count
|
||||
extensionBinaryTextCount[keyStr] = counts
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
// Get all extensions that have more binary occurrences than text
|
||||
var binaryDominantExts []string
|
||||
for ext, counts := range extensionBinaryTextCount {
|
||||
binaryCount := counts[0]
|
||||
textCount := counts[1]
|
||||
|
||||
if binaryCount > textCount {
|
||||
binaryDominantExts = append(binaryDominantExts, ext)
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the extensions
|
||||
sort.Strings(binaryDominantExts)
|
||||
|
||||
// Print only the extensions that are more likely to be binary
|
||||
fmt.Println("Extensions that are predominantly binary:")
|
||||
for _, ext := range binaryDominantExts {
|
||||
counts := extensionBinaryTextCount[ext]
|
||||
fmt.Printf("Extension: %s, Binary Count: %d, Text Count: %d\n",
|
||||
ext, counts[0], counts[1])
|
||||
}
|
||||
}
|
||||
|
||||
func IsStringBinary(s string) bool {
|
||||
|
Reference in New Issue
Block a user