From 67b9ee7cb165998a478c2f81ba4ff5d566e0ae4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Wed, 6 Dec 2023 00:53:09 +0100 Subject: =?UTF-8?q?aoc5:=20with=20sweat=20and=20tears,=20jutri=C5=A1nji=20?= =?UTF-8?q?bo=20verjetno=20nere=C5=A1ljiv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prog/aoc/23/5/1.py | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++ prog/aoc/23/5/in.txt | 33 +++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100755 prog/aoc/23/5/1.py create mode 100644 prog/aoc/23/5/in.txt diff --git a/prog/aoc/23/5/1.py b/prog/aoc/23/5/1.py new file mode 100755 index 0000000..be46b5f --- /dev/null +++ b/prog/aoc/23/5/1.py @@ -0,0 +1,82 @@ +#!/usr/bin/python3 +seeds = [] +maps = [] +from os import getenv +file = open("/root/dl/input5") +if getenv("IN") != None: + file = open("in.txt") +seeds.extend([x for x in map(int, file.readline().strip().split(": ")[1].split(" "))]) +file.readline().strip() +def read_map(): + l = file.readline() + # s = l.split("-")[0] # ne rabimo + # d = l.split("-")[2].split(" ")[0] # ne rabimo + l = file.readline() + v = [] + while l != "\n" and l != "": + v.append((int(l.strip().split(" ")[0]), int(l.strip().split(" ")[1]), int(l.strip().split(" ")[2]))) + l = file.readline() + maps.append(sorted(v, key=lambda x: x[1])) + if l == "": + return False + return True +while read_map(): + pass +def get_next_step(target, steps): # možnost izboljšave z bisekcijo + def helper(): + for index in range(len(steps)): + if index+1 == len(steps): + return steps[index] + if steps[index+1][1] > target: + return steps[index] + r = helper() + # print("r", r) + if r[1] > target: + return target + if r[1] + r[2] - 1 < target: + return target + return r[0]+target-r[1] +locations = {} +for s in seeds: + l = get_next_step(s, maps[0]) + # print("l", l) + for m in maps[1:]: + l = get_next_step(l, m) + # print("l", l) + locations[s] = l +print(min(locations.items(), key=lambda x: x[1])) +from interval import interval, inf +semena = interval() +for i in range(len(seeds)//2): + semena |= interval([seeds[2*i], seeds[2*i]+seeds[2*i+1]]) +print(semena) +def celoštevilski_komplement(intervala): + r = interval() + for i in range(len(intervala)): + if i == 0: + if intervala[i][0] == -inf: + continue + r |= interval([-inf, intervala[i][0]-1]) + if i+1 == len(intervala): + if intervala[i][1] == inf: + continue + r |= interval([intervala[i][1]+1, inf]) + if i != 0: + r |= interval([intervala[i-1][1]+1, intervala[i][0]-1]) + return r +def go_deeper(m, vhod): + r = interval() + porabljeni_sources = interval() + for m in m: + source = interval([m[1], m[1]+m[2]]) + # print("source", source, "!source", celoštevilski_komplement(source)) + # print("m", m, "source", source, "source^C", celoštevilski_komplement(source)) + r |= (source & vhod) + m[0] - m[1] + porabljeni_sources |= source + vhod &= celoštevilski_komplement(porabljeni_sources) + r |= vhod + # print("go_deeper r", r) + return r +for i in range(len(maps)): + semena = go_deeper(maps[i], semena) +print(semena) diff --git a/prog/aoc/23/5/in.txt b/prog/aoc/23/5/in.txt new file mode 100644 index 0000000..f756727 --- /dev/null +++ b/prog/aoc/23/5/in.txt @@ -0,0 +1,33 @@ +seeds: 79 14 55 13 + +seed-to-soil map: +50 98 2 +52 50 48 + +soil-to-fertilizer map: +0 15 37 +37 52 2 +39 0 15 + +fertilizer-to-water map: +49 53 8 +0 11 42 +42 0 7 +57 7 4 + +water-to-light map: +88 18 7 +18 25 70 + +light-to-temperature map: +45 77 23 +81 45 19 +68 64 13 + +temperature-to-humidity map: +0 69 1 +1 0 69 + +humidity-to-location map: +60 56 37 +56 93 4 -- cgit v1.2.3 From 94eee506bce030b236e47ae2d90a7811d20796b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Wed, 6 Dec 2023 00:57:28 +0100 Subject: =?UTF-8?q?malo=20lep=C5=A1i=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prog/aoc/23/5/1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prog/aoc/23/5/1.py b/prog/aoc/23/5/1.py index be46b5f..a64ee26 100755 --- a/prog/aoc/23/5/1.py +++ b/prog/aoc/23/5/1.py @@ -44,12 +44,12 @@ for s in seeds: l = get_next_step(l, m) # print("l", l) locations[s] = l -print(min(locations.items(), key=lambda x: x[1])) +print(min(locations.items(), key=lambda x: x[1])[1]) from interval import interval, inf semena = interval() for i in range(len(seeds)//2): semena |= interval([seeds[2*i], seeds[2*i]+seeds[2*i+1]]) -print(semena) +# print(semena) def celoštevilski_komplement(intervala): r = interval() for i in range(len(intervala)): @@ -79,4 +79,4 @@ def go_deeper(m, vhod): return r for i in range(len(maps)): semena = go_deeper(maps[i], semena) -print(semena) +print(semena[0][0]) -- cgit v1.2.3 From 787a189b5773928bfcb09173c4407475ea6b0219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Wed, 6 Dec 2023 20:09:53 +0100 Subject: DN06 etc --- prog/skovikanje/generiraj.sh | 5 ++-- prog/skovikanje/header.html | 5 ++++ prog/skovikanje/komentar.php | 2 +- prog/skovikanje/komentar.sh | 4 +-- prog/skovikanje/komentarji/+Hxc | 3 ++ prog/skovikanje/komentarji/-vUE | 3 ++ prog/skovikanje/komentarji/-vUEAZXF | 3 ++ prog/skovikanje/komentarji/0oS6 | 2 ++ prog/skovikanje/komentarji/0oS6Owg6 | 2 ++ prog/skovikanje/komentarji/4lzt | 2 ++ prog/skovikanje/komentarji/8raU | 2 ++ prog/skovikanje/komentarji/8raUk1mr | 2 ++ prog/skovikanje/komentarji/Aee4 | 4 +++ prog/skovikanje/komentarji/AnJi | 2 ++ prog/skovikanje/komentarji/BIlW | 4 +++ prog/skovikanje/komentarji/D1B+ | 16 +++++++++++ prog/skovikanje/komentarji/EYOV | 2 ++ prog/skovikanje/komentarji/EYOV6+CT | 2 ++ prog/skovikanje/komentarji/N9y8 | 3 ++ prog/skovikanje/komentarji/OoTc | 2 ++ prog/skovikanje/komentarji/QxPi | 3 ++ prog/skovikanje/komentarji/QxPio4BC | 3 ++ prog/skovikanje/komentarji/c6WY | 2 ++ prog/skovikanje/komentarji/c6WYcQCT | 2 ++ prog/skovikanje/komentarji/kjsX | 3 ++ prog/skovikanje/komentarji/ogGl | 2 ++ prog/skovikanje/komentarji/sREU | 2 ++ prog/skovikanje/komentarji/sREUrLe2 | 2 ++ prog/skovikanje/komentarji/smYG | 4 +++ prog/skovikanje/komentarji/stts | 6 ++++ prog/skovikanje/komentarji/tHMD | 8 ++++++ prog/skovikanje/komentarji/u9XD | 2 ++ prog/skovikanje/komentarji/uXkE | 3 ++ prog/skovikanje/komentarji/v5lR | 3 ++ prog/skovikanje/komentarji/xDAU | 3 ++ prog/skovikanje/komentarji/xezz | 3 ++ prog/skovikanje/komentarji/z6nz | 3 ++ prog/skovikanje/objave/chronostatis | 8 ++++++ prog/skovikanje/objave/hitler | 12 ++++++++ prog/skovikanje/objave/i<3mat | 5 ++++ prog/skovikanje/run.sh | 2 +- skripti/IntsToBytes.java | 14 +++++++++ skripti/prowlarr_enable_all_indexers.sh | 6 ++++ "\305\241ola/p1/dn/Premica.java" | 50 +++++++++++++++++++++++++++++++++ "\305\241ola/p1/dn/Tocka.java" | 27 ++++++++++++++++++ "\305\241ola/p1/dn/tj.sh" | 11 ++++++-- 46 files changed, 251 insertions(+), 8 deletions(-) create mode 100644 prog/skovikanje/komentarji/+Hxc create mode 100644 prog/skovikanje/komentarji/-vUE create mode 100644 prog/skovikanje/komentarji/-vUEAZXF create mode 100644 prog/skovikanje/komentarji/0oS6 create mode 100644 prog/skovikanje/komentarji/0oS6Owg6 create mode 100644 prog/skovikanje/komentarji/4lzt create mode 100644 prog/skovikanje/komentarji/8raU create mode 100644 prog/skovikanje/komentarji/8raUk1mr create mode 100644 prog/skovikanje/komentarji/Aee4 create mode 100644 prog/skovikanje/komentarji/AnJi create mode 100644 prog/skovikanje/komentarji/BIlW create mode 100644 prog/skovikanje/komentarji/D1B+ create mode 100644 prog/skovikanje/komentarji/EYOV create mode 100644 prog/skovikanje/komentarji/EYOV6+CT create mode 100644 prog/skovikanje/komentarji/N9y8 create mode 100644 prog/skovikanje/komentarji/OoTc create mode 100644 prog/skovikanje/komentarji/QxPi create mode 100644 prog/skovikanje/komentarji/QxPio4BC create mode 100644 prog/skovikanje/komentarji/c6WY create mode 100644 prog/skovikanje/komentarji/c6WYcQCT create mode 100644 prog/skovikanje/komentarji/kjsX create mode 100644 prog/skovikanje/komentarji/ogGl create mode 100644 prog/skovikanje/komentarji/sREU create mode 100644 prog/skovikanje/komentarji/sREUrLe2 create mode 100644 prog/skovikanje/komentarji/smYG create mode 100644 prog/skovikanje/komentarji/stts create mode 100644 prog/skovikanje/komentarji/tHMD create mode 100644 prog/skovikanje/komentarji/u9XD create mode 100644 prog/skovikanje/komentarji/uXkE create mode 100644 prog/skovikanje/komentarji/v5lR create mode 100644 prog/skovikanje/komentarji/xDAU create mode 100644 prog/skovikanje/komentarji/xezz create mode 100644 prog/skovikanje/komentarji/z6nz create mode 100644 prog/skovikanje/objave/chronostatis create mode 100644 prog/skovikanje/objave/hitler create mode 100644 prog/skovikanje/objave/i<3mat create mode 100644 skripti/IntsToBytes.java create mode 100755 skripti/prowlarr_enable_all_indexers.sh create mode 100644 "\305\241ola/p1/dn/Premica.java" create mode 100644 "\305\241ola/p1/dn/Tocka.java" diff --git a/prog/skovikanje/generiraj.sh b/prog/skovikanje/generiraj.sh index a399102..b0ca566 100755 --- a/prog/skovikanje/generiraj.sh +++ b/prog/skovikanje/generiraj.sh @@ -8,14 +8,15 @@ echo "

nazaj na varno (na mojo spletno stran)$desc RSS

" echo "$title$deschttp://z.4a.si/skovikanje/" > $1 +echo "
" for file in `ls --sort=time --time=birth objave` do - echo "
" ./komentar.sh objava html $file 0 cat header.html <(./komentar.sh objava html $file 1) > skovik/$file.html echo "" >> $1 RSS_BASEURL=http://z.4a.si/skovikanje/skovik/ ./komentar.sh objava rss $file >> $1 echo "" >> $1 + echo "
" done -echo "
$0 $@ | `date` | `hostname` | $(($(date +%s%N)/1000000-$start)) ms" +echo "$0 $@ | `date` | `hostname` | $(($(date +%s%N)/1000000-$start)) ms" echo '
' >> $1 diff --git a/prog/skovikanje/header.html b/prog/skovikanje/header.html index 8eb2962..3cd720b 100644 --- a/prog/skovikanje/header.html +++ b/prog/skovikanje/header.html @@ -7,6 +7,11 @@ a { overflow-wrap: break-word; } +html { + margin: auto; + max-width: 60em; + text-align: justify; +} diff --git a/prog/skovikanje/komentar.php b/prog/skovikanje/komentar.php index 662b7b4..78b9c6e 100644 --- a/prog/skovikanje/komentar.php +++ b/prog/skovikanje/komentar.php @@ -17,7 +17,7 @@ if (!empty($_POST["antispam"])) $_SESSION["antispam"] = $_POST["antispam"]; if (str_contains($koga, "..") || str_contains($koga, "/")) die("brez .. in / v id-ju komentarja!"); -$naregex = "/^[a-z0-9-+čžš]*$/i"; +$naregex = "/^[a-z0-9-+čžš<>]*$/i"; if (!preg_match($naregex, $na)) { die("na bi moral ustrezati $naregex"); } diff --git a/prog/skovikanje/komentar.sh b/prog/skovikanje/komentar.sh index 9b9d8b9..bc7f75b 100755 --- a/prog/skovikanje/komentar.sh +++ b/prog/skovikanje/komentar.sh @@ -103,7 +103,7 @@ then spisal=`head -n1 objave/$3 | cut -f2` if [ $2 = rss ] then - echo "$3$naslov$metadesc`date --rfc-email --date $spisal`$RSS_BASEURL$3.html" + echo "`hsc <<<$3`$naslov$metadesc`date --rfc-email --date $spisal`$RSS_BASEURL`hsc <<<$3`.html" exit fi echo "" @@ -151,7 +151,7 @@ then done vey="" tripiyje="" - if [ `wc -l < objave/$3` -gt 5 ] + if [ `wc -l < objave/$3` -gt 4 ] then vey=" ogled celotnega besedila," tripiyje="..." diff --git a/prog/skovikanje/komentarji/+Hxc b/prog/skovikanje/komentarji/+Hxc new file mode 100644 index 0000000..d109868 --- /dev/null +++ b/prog/skovikanje/komentarji/+Hxc @@ -0,0 +1,3 @@ +hitler $2y$10$MVYUyCCcKalE/QCPGCkadu3m3LKWx.VQ9tsQUs.atR13oSdNV1WAW +You mean like this? +!https://j.gifs.com/y0X435.gif diff --git a/prog/skovikanje/komentarji/-vUE b/prog/skovikanje/komentarji/-vUE new file mode 100644 index 0000000..c138ffa --- /dev/null +++ b/prog/skovikanje/komentarji/-vUE @@ -0,0 +1,3 @@ +test nig $2y$10$HCqY93vGmSYqqmOPyCdTbOvwHyhOnX87arL8oa8/CZtnFhQoZ1GxO +g +>>-vUEAZXF diff --git a/prog/skovikanje/komentarji/-vUEAZXF b/prog/skovikanje/komentarji/-vUEAZXF new file mode 100644 index 0000000..c138ffa --- /dev/null +++ b/prog/skovikanje/komentarji/-vUEAZXF @@ -0,0 +1,3 @@ +test nig $2y$10$HCqY93vGmSYqqmOPyCdTbOvwHyhOnX87arL8oa8/CZtnFhQoZ1GxO +g +>>-vUEAZXF diff --git a/prog/skovikanje/komentarji/0oS6 b/prog/skovikanje/komentarji/0oS6 new file mode 100644 index 0000000..0a7a14c --- /dev/null +++ b/prog/skovikanje/komentarji/0oS6 @@ -0,0 +1,2 @@ +test + diff --git a/prog/skovikanje/komentarji/0oS6Owg6 b/prog/skovikanje/komentarji/0oS6Owg6 new file mode 100644 index 0000000..0a7a14c --- /dev/null +++ b/prog/skovikanje/komentarji/0oS6Owg6 @@ -0,0 +1,2 @@ +test + diff --git a/prog/skovikanje/komentarji/4lzt b/prog/skovikanje/komentarji/4lzt new file mode 100644 index 0000000..6ad3203 --- /dev/null +++ b/prog/skovikanje/komentarji/4lzt @@ -0,0 +1,2 @@ +test anton $2y$10$h0kWAjUVY5ZS.b5ucBeRMeNETyxmqIFj58ZrA0GTwqA2NgbF38G6O +test vrnitve diff --git a/prog/skovikanje/komentarji/8raU b/prog/skovikanje/komentarji/8raU new file mode 100644 index 0000000..5fe100a --- /dev/null +++ b/prog/skovikanje/komentarji/8raU @@ -0,0 +1,2 @@ +test +