Last active 1734276243

x-way revised this gist 1734276242. Go to revision

No changes

x-way's Avatar Andreas Jaggi revised this gist 1371013397. Go to revision

1 file changed, 0 insertions, 0 deletions

LICENSE renamed to punchcard.awk_LICENSE

File renamed without changes

x-way's Avatar Andreas Jaggi revised this gist 1371012818. Go to revision

1 file changed, 21 insertions

LICENSE(file created)

@@ -0,0 +1,21 @@
1 + The MIT License (MIT)
2 +
3 + Copyright (c) 2011 Andreas Jaggi <andreas.jaggi@waterwave.ch>
4 +
5 + Permission is hereby granted, free of charge, to any person obtaining a copy
6 + of this software and associated documentation files (the "Software"), to deal
7 + in the Software without restriction, including without limitation the rights
8 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 + copies of the Software, and to permit persons to whom the Software is
10 + furnished to do so, subject to the following conditions:
11 +
12 + The above copyright notice and this permission notice shall be included in
13 + all copies or substantial portions of the Software.
14 +
15 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 + THE SOFTWARE.

x-way's Avatar Andreas Jaggi revised this gist 1316393004. Go to revision

1 file changed, 79 insertions

punchcard.awk(file created)

@@ -0,0 +1,79 @@
1 + #!/usr/bin/awk -f
2 + #
3 + # punchcard.awk - ASCII 'punchcard' graph for git log
4 + #
5 + # Written in September 2011 by Andreas Jaggi <andreas.jaggi@waterwave.ch>
6 + #
7 + # usage:$ git log | punchcard.awk
8 + # +-------------------------------------------------------------------------------------------------+
9 + # Tue | . . o . . o O O 0 O |
10 + # Wed | . . . . 0 O o |
11 + # Thu | . . o O . . o o . . . |
12 + # Fri | . . . . O o o |
13 + # Sat | . . O . |
14 + # Sun | . O o . o o o o o . . |
15 + # Mon | . . . . . . . . o O O . . o 0 |
16 + # +-------------------------------------------------------------------------------------------------+
17 + # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
18 + #
19 + BEGIN {
20 + days[1] = "Mon";
21 + days[2] = "Tue";
22 + days[3] = "Wed";
23 + days[4] = "Thu";
24 + days[5] = "Fri";
25 + days[6] = "Sat";
26 + days[7] = "Sun";
27 +
28 + for (d in days) {
29 + for ( h = 0; h < 24; h++ ) {
30 + data[days[d],h] = 0;
31 + }
32 + }
33 + max = 0;
34 + }
35 + /Date:/{
36 + split($5,m,":");
37 + data[$2,(1*m[1])] = data[$2,(1*m[1])]+1;
38 + if ( data[$2,(1*m[1])] > max ) {
39 + max = data[$2,(1*m[1])];
40 + }
41 + }
42 + END {
43 + printf(" +");
44 + for ( h = 0; h < 24; h++ ) {
45 + printf("----", h);
46 + }
47 + printf("-+\n");
48 + for (d in days) {
49 + printf("%s |", days[d]);
50 + for ( h = 0; h < 24; h++ ) {
51 + v = (4.0*data[days[d],h])/(max*1.0);
52 + if ( v <= 0 ) {
53 + printf(" ");
54 + }
55 + if ( (v > 0) && (v < 1) ) {
56 + printf(" . ");
57 + }
58 + if ( (v >= 1) && (v < 2) ) {
59 + printf(" o ");
60 + }
61 + if ( (v >= 2) && (v < 3) ) {
62 + printf(" O ");
63 + }
64 + if ( (v >= 3) ) {
65 + printf(" 0 ");
66 + }
67 + }
68 + printf(" |\n")
69 + }
70 + printf(" +");
71 + for ( h = 0; h < 24; h++ ) {
72 + printf("----", h);
73 + }
74 + printf("-+\n ");
75 + for ( h = 0; h < 24; h++ ) {
76 + printf("%- 3d ", h);
77 + }
78 + printf("\n");
79 + }
Newer Older