Last active
December 24, 2025 14:38
-
-
Save Luna-devv/b27e91e5b083973f702f3d0d185a0eda to your computer and use it in GitHub Desktop.
Get weekly usage stats from DNF-based Linux distros
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Download totals.db from https://data-analysis.fedoraproject.org/csv-reports/countme/ | |
| // | |
| // curl -fsSL https://bun.sh/install | bash | |
| // bun run dnf-count.ts | |
| import { Database } from "bun:sqlite"; | |
| const db = new Database("totals.db"); | |
| const query = db.query(` | |
| SELECT | |
| date(julianday('1970-01-05') + weeknum * 7) as week_date, | |
| os_name, | |
| SUM(max_hits) as weekly_users | |
| FROM ( | |
| SELECT weeknum, os_name, os_version, os_variant, os_arch, sys_age, MAX(hits) as max_hits | |
| FROM countme_totals | |
| GROUP BY weeknum, os_name, os_version, os_variant, os_arch, sys_age | |
| ) | |
| WHERE week_date = (SELECT date(julianday('1970-01-05') + MAX(weeknum) * 7) FROM countme_totals) | |
| GROUP BY os_name | |
| `); | |
| const raw = query.all() as { week_date: string; os_name: string; weekly_users: number }[]; | |
| const mapping: Record<string, string> = { | |
| "Fedora Linux": "Fedora", | |
| "Fedora": "Fedora", | |
| "Fedora Linux Asahi Remix": "Fedora", | |
| "CentOS Stream": "CentOS", | |
| "CentOS Linux": "CentOS", | |
| "": "Unknown / Generic" | |
| }; | |
| const merged = raw.reduce((acc, curr) => { | |
| const name = mapping[curr.os_name] || curr.os_name; | |
| acc[name] = (acc[name] || 0) + curr.weekly_users; | |
| return acc; | |
| }, {} as Record<string, number>); | |
| const top = Object.entries(merged) | |
| .sort(([, a], [, b]) => b - a) | |
| .slice(0,20) | |
| const intl = new Intl.NumberFormat("en-us"); | |
| console.log("Cleaned Weekly User Base:"); | |
| console.table(top.map(([name, users]) => ({ distro: name, weekly_users: intl.format(users) }))); |
Author
Luna-devv
commented
Dec 20, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment