Created
          April 17, 2025 03:36 
        
      - 
      
- 
        Save IsaacGemal/ad9a69f74ff3138748b80b5fb333688d to your computer and use it in GitHub Desktop. 
    Git time histogram
  
        
  
    
      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
    
  
  
    
  | git log --date=format:%H --pretty=format:%ad | \ | |
| awk ' | |
| { h = int($0); cnt[h]++; total++ } # collect counts & grand total | |
| END { | |
| # find max bucket to rescale bars | |
| for (i = 0; i < 24; i++) if (cnt[i] > max) max = cnt[i] | |
| barWidth = 50 # chars for the widest bar | |
| for (i = 0; i < 24; i++) { | |
| ampm = (i < 12) ? "AM" : "PM" | |
| hr = (i % 12 == 0) ? 12 : i % 12 | |
| pct = (total ? cnt[i] * 100 / total : 0) | |
| len = (max ? int(cnt[i] * barWidth / max) : 0) | |
| printf "%2d%s | %6d | %5.1f%% | ", hr, ampm, cnt[i], pct | |
| for (j = 0; j < len; j++) printf "█" | |
| print "" | |
| } | |
| }' | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment