Add 2022 day 6
Diff
README | 4 ++--
2022/6/.gitignore | 2 ++
2022/6/apache2.conf | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2022/6/read.sh | 9 +++++++++
4 files changed, 169 insertions(+), 2 deletions(-)
@@ -19,8 +19,8 @@
| 3 | Haskell | | 3 | Clojure |
| 4 | Haskell | | 4 | Jsonnet |
| 5 | Rust | | 5 | HCL/TF |
| 6 | Haskell | +---------------------+
| 7 | Haskell |
| 6 | Haskell | | 6 | Apache2 |
| 7 | Haskell | +---------------------+
| 8 | Haskell |
| 9 | Haskell |
| 10 | Haskell |
@@ -1,0 +1,2 @@
httpd.pid
logs
@@ -1,0 +1,156 @@
LoadModule mpm_prefork_module libexec/apache2/mod_mpm_prefork.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule unixd_module libexec/apache2/mod_unixd.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule headers_module libexec/apache2/mod_headers.so
ServerRoot .
PidFile ./httpd.pid
RewriteEngine On
Listen 8888
<VirtualHost *:8888>
LogLevel debug
RedirectMatch 301 ^/part1/(.*)$ /part1-iter/$1/1
RewriteRule ^/part1-iter/(.)(.)(.)(.) - [E=C1:$1,E=C2:$2,E=C3:$3,E=C4:$4]
RewriteCond %{ENV:C1}
RewriteCond %{ENV:C1}
RewriteCond %{ENV:C1}
RewriteCond %{ENV:C2}
RewriteCond %{ENV:C2}
RewriteCond %{ENV:C3}
RewriteRule ^ - [E=ALL_PART1_CHARS_DISTINCT:1]
RewriteCond %{ENV:ALL_PART1_CHARS_DISTINCT} =1
RewriteRule ^/part1-iter/(.{4})[^/]*/(1+)$ /part1-complete/$1/111$2 [R=301,L]
RewriteCond %{ENV:ALL_PART1_CHARS_DISTINCT} !=1
RewriteRule ^/part1-iter/.([^/]+)/(1+)$ /part1-iter/$1/1$2 [R=301,L]
RedirectMatch 301 ^/part2/(.*)$ /part2-iter/$1/1
RewriteRule ^/part2-iter/(.)(.)(.)(.)(.)(.)(.)(.)(.) - [E=CC1:$1,E=CC2:$2,E=CC3:$3,E=CC4:$4,E=CC5:$5,E=CC6:$6,E=CC7:$7,E=CC8:$8,E=CC9:$9]
RewriteRule ^/part2-iter/.{9}(.)(.)(.)(.)(.) - [E=CC10:$1,E=CC11:$2,E=CC12:$3,E=CC13:$4,E=CC14:$5]
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC1}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC2}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC3}
RewriteCond %{ENV:CC4}
RewriteCond %{ENV:CC4}
RewriteCond %{ENV:CC4}
RewriteCond %{ENV:CC4}
RewriteCond %{ENV:CC4}
RewriteCond %{ENV:CC4}
RewriteCond %{ENV:CC4}
RewriteCond %{ENV:CC4}
RewriteCond %{ENV:CC4}
RewriteCond %{ENV:CC4}
RewriteCond %{ENV:CC5}
RewriteCond %{ENV:CC5}
RewriteCond %{ENV:CC5}
RewriteCond %{ENV:CC5}
RewriteCond %{ENV:CC5}
RewriteCond %{ENV:CC5}
RewriteCond %{ENV:CC5}
RewriteCond %{ENV:CC5}
RewriteCond %{ENV:CC5}
RewriteCond %{ENV:CC6}
RewriteCond %{ENV:CC6}
RewriteCond %{ENV:CC6}
RewriteCond %{ENV:CC6}
RewriteCond %{ENV:CC6}
RewriteCond %{ENV:CC6}
RewriteCond %{ENV:CC6}
RewriteCond %{ENV:CC6}
RewriteCond %{ENV:CC7}
RewriteCond %{ENV:CC7}
RewriteCond %{ENV:CC7}
RewriteCond %{ENV:CC7}
RewriteCond %{ENV:CC7}
RewriteCond %{ENV:CC7}
RewriteCond %{ENV:CC7}
RewriteCond %{ENV:CC8}
RewriteCond %{ENV:CC8}
RewriteCond %{ENV:CC8}
RewriteCond %{ENV:CC8}
RewriteCond %{ENV:CC8}
RewriteCond %{ENV:CC8}
RewriteCond %{ENV:CC9}
RewriteCond %{ENV:CC9}
RewriteCond %{ENV:CC9}
RewriteCond %{ENV:CC9}
RewriteCond %{ENV:CC9}
RewriteCond %{ENV:CC10}
RewriteCond %{ENV:CC10}
RewriteCond %{ENV:CC10}
RewriteCond %{ENV:CC10}
RewriteCond %{ENV:CC11}
RewriteCond %{ENV:CC11}
RewriteCond %{ENV:CC11}
RewriteCond %{ENV:CC12}
RewriteCond %{ENV:CC12}
RewriteCond %{ENV:CC13}
RewriteRule ^ - [E=ALL_PART2_CHARS_DISTINCT:1]
RewriteCond %{ENV:ALL_PART2_CHARS_DISTINCT} =1
RewriteRule ^/part2-iter/(.{14})[^/]*/(1+)$ /part2-complete/$1/1111111111111$2 [R=301,L]
RewriteCond %{ENV:ALL_PART2_CHARS_DISTINCT} !=1
RewriteRule ^/part2-iter/.([^/]+)/(1+)$ /part2-iter/$1/1$2 [R=301,L]
</VirtualHost>
@@ -1,0 +1,9 @@
STDIN=$(cat -)
PART1=$(curl --max-redirs 100000 -Ls "http://127.0.0.1:8888/part1/$STDIN" -o /dev/null -w %{url_effective})
echo $(echo $PART1 | gsed -E 's/.*\/([1]+)/\1/' | tr -d '\n' | wc -c)
PART2=$(curl --max-redirs 100000 -Ls "http://127.0.0.1:8888/part2/$STDIN" -o /dev/null -w %{url_effective})
echo $(echo $PART2 | gsed -E 's/.*\/([1]+)/\1/' | tr -d '\n' | wc -c)