Skip to content

Instantly share code, notes, and snippets.

@LukasCBossert
Last active December 28, 2024 06:21
Show Gist options
  • Save LukasCBossert/3df7b539713378c3c2d9353d6d0f7ec2 to your computer and use it in GitHub Desktop.
Save LukasCBossert/3df7b539713378c3c2d9353d6d0f7ec2 to your computer and use it in GitHub Desktop.
Summary of org and org-roam statistics

Summary of org and org-roam statistics

Currently, as of src_sh{date ‘+%Y-%m-%d’}, I have call_find-number-of-org-files-in-emacs-home() (that is call_find-megabytes-of-org-in-emacs-dir()) of .org files. In total there are call_find-lines-of-org-in-home-org() lines of text, the largest single file is call_find-largest-size-org-mode-file-lines-in-home-org() and the longest lined file has call_find-largest-lined-org-mode-file-lines-in-home-org() lines, overall there are call_find-number-of-headlines-in-org-files-in-home-org() headlines. Furthermore there are call_find-nodes-in-org-roam()[:db (eval org-roam-db-location)] nodes across call_find-files-in-org-roam()[:db (eval org-roam-db-location)] files inside my personal information management system that is based upon denote, call_find-number-of-org-files-in-daily-directory() of those are “dailies”. call_find-number-of-org-files-containing-TODOs() files contain TODO, call_find-number-of-org-files-containing-INPROGRESS() files contain INPROGRESS, call_find-number-of-org-files-containing-WAITING() files contain WAITING and call_find-number-of-org-files-containing-DONEs() DONE entries.

#emacs #orgmode #orgroam #orgroamui #pkm #denote

Stats about org-roam and org like TODOs etc.

Getting the main directory of all my .org-files.

doom-user-dir

Specify in which directory we have the files belonging to the personal information management system.

org-directory

Finding out how much storage space is taken by the .org-files.

find "$org_dir" -type f -name "*.org" -exec du -ch {} + | grep total$ | awk '{print $1}'

This is the number of all the .org-files in the main directory.

find "$org_dir"  -type f -name "*.org" | wc -l | tr -d " "

This one is actually obsolete for now since we are counting the nodes instead of files because we are using org-roam.

find "$org_dir" -maxdepth 1 -type f -name "*.org" | wc -l | tr -d " "

Counting the files from the daily-directory. There can only be max one file per day.

find "$org_dir"/daily  -type f -name "*.org" | wc -l | tr -d " "

Counting the overall number of lines from all the .org-files.

find "$org_dir" -maxdepth 1 -type f -name "*.org" -exec wc -l {} + | awk '{sum += $1} END {printf "%2.f", sum}'

This gives the size of the biggest file in the main directory.

find "$org_dir" -maxdepth 1 -type f -name "*.org" -exec stat -f "%z %N" {} + | sort -n -r | head -n 1 | awk '{printf "%.2f MB\n", $1/1024/1024}'
find "$org_dir"  -type f -name "*.org" -exec wc -l {} + | sort -n -r | head -n 2 | tail -n 1 | awk '{print $1}'
select count(*) from nodes ;

Total amount of files that have an (org-roam) ID.

select count(*) from files ;

This gives a summary of the total amount of headlines in all of the .org-files.

grep -rh '^\*' "$org_dir"/*.org | wc -l | tr -d " "

Now focusing on files that have a TODO entry.

rg "^\*+.+TODO\s" --count-matches "$org_dir" | awk -F: '{sum += $2} END {print sum}'

Now focusing on files that have a INPROGRESS entry.

rg "^\*+.+INPROGRESS\s" --count-matches "$org_dir" | awk -F: '{sum += $2} END {print sum}'

Now focusing on files that have a WAITING entry.

rg "^\*+.+WAITING\s" --count-matches "$org_dir" | awk -F: '{sum += $2} END {print sum}'

Now focusing on files that have a DONE entry.

rg "^\*+.+DONE\s" --count-matches "$org_dir" | awk -F: '{sum += $2} END {print sum}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment