Skip to content

Commit 8ac5169

Browse files
committed
Improve github syntax highlight
Mark shellscripts as awkscripts, as: - our scripts consist mainly of awk and this change gives better highlight - it doesn't seem to break highlighter
1 parent 8589f03 commit 8ac5169

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

day1/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
## task1
22
Create sorted list of summaric caloricity of each each elf inventory and extract "the richest elf"
3-
```sh
3+
```awk
44
awk -vRS="\n\n" -F"\n" '{s=0; for(i=1; i<=NF; ++i) s+=$i; print s}' in.txt | sort | tail -n1
55
```
66

77
## task2
88
Create sorted list of summaric caloricity of each each elf inventory and compute sum of "three richest elfs"
9-
```sh
9+
```awk
1010
awk -vRS="\n\n" -F"\n" '{s=0; for(i=1; i<=NF; ++i) s+=$i; print s}' in.txt | sort | tail -n3 | awk '{s+=$1}END{print s}'
1111
```

day2/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## task1
22
- Convert encoding into more readable notation (R)ock, (P)aper, (S)cisors
33
- Create lookup table for score couting and compute score
4-
```sh
4+
```awk
55
tr 'ABCXYZ' 'RPSRPS' < in.txt |
66
awk 'BEGIN {
77
LUT["RR"]=4; LUT["PP"]=5; LUT["SS"]=6; # draws
@@ -13,7 +13,7 @@ END { print points }'
1313
## task2
1414
- Convert encoding into more readable notation (R)ock, (P)aper, (S)cisors, (L)ose, (D)raw, (W)in
1515
- Create lookup table for score couting and compute score
16-
```sh
16+
```awk
1717
tr 'ABCXYZ' 'RPSLDW' < in.txt |
1818
awk 'BEGIN {
1919
LUT["RD"]=4; LUT["PD"]=5; LUT["SD"]=6; # draws

day3/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- build lookup table for priorities
33
- for each line find item present in both compartments and add its piority to sum
44

5-
```sh
5+
```awk
66
awk -F '' '
77
BEGIN{ for(i=0; i<26;i++) LUT[sprintf("%c",i+97)]=i+1; } # a-z (97 - "a" ascii code)
88
BEGIN{ for(i=0; i<26;i++) LUT[sprintf("%c",i+65)]=i+27; } # A-Z (65 - "A" ascii code)
@@ -15,7 +15,7 @@ BEGIN{ for(i=0; i<26;i++) LUT[sprintf("%c",i+65)]=i+27; } # A-Z (65 - "A" ascii
1515
- join every group of 3 lines into one line
1616
- build lookup table for priorities
1717
- for each group find item present in all 3 rucksacks and add its piority to sum
18-
```sh
18+
```awk
1919
xargs -n3 <in.txt | awk '
2020
BEGIN{ for(i=0; i<26;i++) LUT[sprintf("%c",i+97)]=i+1; } # a-z (97 - "a" ascii code)
2121
BEGIN{ for(i=0; i<26;i++) LUT[sprintf("%c",i+65)]=i+27; } # A-Z (65 - "A" ascii code)

0 commit comments

Comments
 (0)