Skip to content

Instantly share code, notes, and snippets.

View AlDanial's full-sized avatar

AlDanial

View GitHub Profile
@AlDanial
AlDanial / lapack_3.9.0_code_line_distribution.txt
Created December 4, 2021 20:43
Sample output from aggregate_by_folder.py using LAPACK 3.9.0 source tar ball.
cloc --by-file --csv --out data.csv lapack-3.9.0.tar.gz
./aggregate_by_folder.py data.csv | grep -Pv "\s0\s*$"
blank code comment
folder
lapack-3.9.0 216 1145 168
lapack-3.9.0/BLAS/SRC 81 16185 25996
lapack-3.9.0/BLAS/TESTING 20 21849 7426
lapack-3.9.0/CBLAS 21 96 14
lapack-3.9.0/CBLAS/cmake 8 20 9
lapack-3.9.0/CBLAS/examples 19 143 8
@AlDanial
AlDanial / aggregate_by_folder.py
Created December 4, 2021 20:38
Program to compute histogram bins of code line counts by project folder using line counts from cloc.
#!/usr/bin/env python
# A solution to
# https://stackoverflow.com/questions/70182311/is-there-a-tool-that-shows-a-distribution-of-lines-of-code-per-file-of-a-folder
import sys
import os.path
import pandas as pd
def add_folder(df):
"""
Return a Pandas dataframe with an additional 'folder' column
containing each file's parent directory