diff options
56 files changed, 556 insertions, 8 deletions
diff --git a/prog/aoc/23/5/1.py b/prog/aoc/23/5/1.py new file mode 100755 index 0000000..a64ee26 --- /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])[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[0][0]) 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 diff --git a/prog/aoc/23/6/1.py b/prog/aoc/23/6/1.py new file mode 100755 index 0000000..1539b09 --- /dev/null +++ b/prog/aoc/23/6/1.py @@ -0,0 +1,32 @@ +#!/usr/bin/python3 +timestr = input().split(":")[1] +time = timestr.split(" ") +try: + while True: + time.remove("") +except: + pass +time = [x for x in map(int, time)] +distancestr = input().split(":")[1] +distance = distancestr.split(" ") +try: + while True: + distance.remove("") +except: + pass +distance = [x for x in map(int, distance)] +product = 1 +for i in range(len(time)): + ways = 0 + for j in range(time[i]): + if (time[i]-j)*j > distance[i]: + ways += 1 + product *= ways +print(product) +ways = 0 +t = int(timestr.replace(" ", "")) +d = int(distancestr.replace(" ", "")) +for j in range(t): + if (t-j)*j > d: + ways += 1 +print(ways) diff --git a/prog/aoc/23/6/in.txt b/prog/aoc/23/6/in.txt new file mode 100644 index 0000000..28f5ae9 --- /dev/null +++ b/prog/aoc/23/6/in.txt @@ -0,0 +1,2 @@ +Time: 7 15 30 +Distance: 9 40 200 diff --git a/prog/aoc/23/7/1.py b/prog/aoc/23/7/1.py new file mode 100755 index 0000000..e1d66da --- /dev/null +++ b/prog/aoc/23/7/1.py @@ -0,0 +1,84 @@ +#!/usr/bin/python3 +from functools import cmp_to_key +hands = [] +try: + while True: + hands.append(input().split(" ")) +except EOFError: + pass +alphabet = ["A", "K", "Q", "J", "T", "9", "8", "7", "6", "5", "4", "3", "2"]; +def level(a): + if len(set(a)) == 1: + return 6 + if len(set(a)) == 2: + if a.count(a[0]) == 1 or a.count(a[0]) == 4: + return 5 + return 4 + if len(set(a)) == 3: + if a.count(list(set(a))[0]) == 3 or a.count(list(set(a))[1]) == 3 or a.count(list(set(a))[2]) == 3: + return 3 + return 2 + if len(set(a)) == 5: + return 0 + return 1 +def compar(a, b): + a = a[0] + b = b[0] + if level(a) > level(b): + return 1 + if level(b) > level(a): + return -1 + for i in range(len(a)): + if alphabet.index(a[i]) < alphabet.index(b[i]): + return 1 + if alphabet.index(b[i]) < alphabet.index(a[i]): + return -1 + return 0 +hands.sort(key=cmp_to_key(compar)) +i = 1 +s = 0 +for h in hands: + print(h, level(h[0])) + s += int(h[1])*i + i += 1 +print(s) +alphabet = ["A", "K", "Q", "T", "9", "8", "7", "6", "5", "4", "3", "2", "J"]; +def level(a): + r = set(a)-set(["J"]) + if len(r) == 0 or len(r) == 1: + return 6 + if len(r) == 5: + return 0 + if len(r) == 2: + c2 = a.count("J")+a.count(list(r)[0]) + c1 = a.count("J")+a.count(list(r)[1]) + if c1 == 4 or c2 == 4: + return 5 + return 4 + if len(r) == 3: + l = a.count("J") + if l+a.count(list(set(r))[0]) == 3 or l+a.count(list(set(r))[1]) == 3 or l+a.count(list(set(r))[2]) == 3: + return 3 + return 2 + return 1 +def compar(a, b): + a = a[0] + b = b[0] + if level(a) > level(b): + return 1 + if level(b) > level(a): + return -1 + for i in range(len(a)): + if alphabet.index(a[i]) < alphabet.index(b[i]): + return 1 + if alphabet.index(b[i]) < alphabet.index(a[i]): + return -1 + return 0 +hands.sort(key=cmp_to_key(compar)) +i = 1 +s = 0 +for h in hands: + print(h, level(h[0])) + s += int(h[1])*i + i += 1 +print(s) diff --git a/prog/aoc/23/7/in.txt b/prog/aoc/23/7/in.txt new file mode 100644 index 0000000..e3500c3 --- /dev/null +++ b/prog/aoc/23/7/in.txt @@ -0,0 +1,5 @@ +32T3K 765 +T55J5 684 +KK677 28 +KTJJT 220 +QQQJA 483 diff --git a/prog/aoc/23/8/1.py b/prog/aoc/23/8/1.py new file mode 100755 index 0000000..9ff0113 --- /dev/null +++ b/prog/aoc/23/8/1.py @@ -0,0 +1,43 @@ +#!/usr/bin/python3 +inst = input() +input() +graph = {} +try: + while True: + a = input().split(" = ") + graph[a[0]] = a[1].replace("(", "").replace(")", "").split(", ") +except EOFError: + pass +cur = "AAA" +runs = 0 +while True: + for d in inst: + if cur == "ZZZ": + break + if d == "L": + cur = graph[cur][0] + else: + cur = graph[cur][1] + runs += 1 + else: + continue + break +print(runs) +r = [] +for s in [x for x in graph if x[2] == "A"]: + runs = 0 + while True: + for d in inst: + if s[2] == "Z": + break + if d == "L": + s = graph[s][0] + else: + s = graph[s][1] + runs += 1 + else: + continue + break + r.append(runs) +from math import lcm +print(lcm(*r)) diff --git a/prog/aoc/23/8/1.txt b/prog/aoc/23/8/1.txt new file mode 100644 index 0000000..9029a1b --- /dev/null +++ b/prog/aoc/23/8/1.txt @@ -0,0 +1,9 @@ +RL + +AAA = (BBB, CCC) +BBB = (DDD, EEE) +CCC = (ZZZ, GGG) +DDD = (DDD, DDD) +EEE = (EEE, EEE) +GGG = (GGG, GGG) +ZZZ = (ZZZ, ZZZ) diff --git a/prog/aoc/23/8/2.txt b/prog/aoc/23/8/2.txt new file mode 100644 index 0000000..7d1b58d --- /dev/null +++ b/prog/aoc/23/8/2.txt @@ -0,0 +1,5 @@ +LLR + +AAA = (BBB, BBB) +BBB = (AAA, ZZZ) +ZZZ = (ZZZ, ZZZ) diff --git a/prog/aoc/23/8/3.txt b/prog/aoc/23/8/3.txt new file mode 100644 index 0000000..5b3fa58 --- /dev/null +++ b/prog/aoc/23/8/3.txt @@ -0,0 +1,10 @@ +LR + +11A = (11B, XXX) +11B = (XXX, 11Z) +11Z = (11B, XXX) +22A = (22B, XXX) +22B = (22C, 22C) +22C = (22Z, 22Z) +22Z = (22B, 22B) +XXX = (XXX, XXX) 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 "<h3><a href=//splet.šijanec.eu./>nazaj na varno (na mojo spletno stran)</ desc="Tu so objave, ki se mi ne zdijo vredne objave na prvi strani. Za njihovo kvaliteto ne odgovarjam, je pa moč pod vsako objavo puščati komentarje." echo "<p>$desc <a href=rss.xml>RSS</a></p>" echo "<?xml version='1.0' encoding='UTF-8' ?><rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'><atom:link href='http://z.4a.si/skovikanje/rss.xml' rel='self' type='application/rss+xml' /><channel><title>$title</title><description>$desc</description><link>http://z.4a.si/skovikanje/</link>" > $1 +echo "<hr id=vrh>" for file in `ls --sort=time --time=birth objave` do - echo "<hr>" ./komentar.sh objava html $file 0 cat header.html <(./komentar.sh objava html $file 1) > skovik/$file.html echo "<item>" >> $1 RSS_BASEURL=http://z.4a.si/skovikanje/skovik/ ./komentar.sh objava rss $file >> $1 echo "</item>" >> $1 + echo "<hr>" done -echo "<hr><small style=display:flex;justify-content:center;align-items:center><a href=//ni.šijanec.eu./sijanec/r/tree/prog/skovikanje><code>$0 $@</code> | `date` | `hostname` | $(($(date +%s%N)/1000000-$start)) ms</a></small>" +echo "<small style=display:flex;justify-content:center;align-items:center><a href=//ni.šijanec.eu./sijanec/r/tree/prog/skovikanje><code>$0 $@</code> | `date` | `hostname` | $(($(date +%s%N)/1000000-$start)) ms</a></small>" echo '</channel></rss>' >> $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; +} </style> <meta name=viewport content='width=device-width, initial-scale=1.0'> <link rel=alternate type=application/rss+xml title=RSS href=/skovikanje/rss.xml> 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 "<guid isPermaLink='false'>$3</guid><title>$naslov</title><description>$metadesc</description><pubDate>`date --rfc-email --date $spisal`</pubDate><link>$RSS_BASEURL$3.html</link>" + echo "<guid isPermaLink='false'>`hsc <<<$3`</guid><title>$naslov</title><description>$metadesc</description><pubDate>`date --rfc-email --date $spisal`</pubDate><link>$RSS_BASEURL`hsc <<<$3`.html</link>" exit fi echo "<meta name=referrer content=unsafe-url />" @@ -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 +<h onmouseover="javascript:alert(document.cookie)"> 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 +<h onmouseover="javascript:alert(document.cookie)"> 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 +<script>alert(1) diff --git a/prog/skovikanje/komentarji/8raUk1mr b/prog/skovikanje/komentarji/8raUk1mr new file mode 100644 index 0000000..5fe100a --- /dev/null +++ b/prog/skovikanje/komentarji/8raUk1mr @@ -0,0 +1,2 @@ +test +<script>alert(1) diff --git a/prog/skovikanje/komentarji/Aee4 b/prog/skovikanje/komentarji/Aee4 new file mode 100644 index 0000000..1a63edc --- /dev/null +++ b/prog/skovikanje/komentarji/Aee4 @@ -0,0 +1,4 @@ +i<3mat <'_'> $2y$10$QWloK0Ll23.huOeqv/R0BebJRYI9nbsdnD7kJxJzC0k/4vkVnMxUC +Jebeš browserje
+
+!\ diff --git a/prog/skovikanje/komentarji/AnJi b/prog/skovikanje/komentarji/AnJi new file mode 100644 index 0000000..3a778b9 --- /dev/null +++ b/prog/skovikanje/komentarji/AnJi @@ -0,0 +1,2 @@ +test anton@sijanec.eu $2y$10$AfTk9cvVIDW9IrrnuMwXv.cVmlmv.YNxEQYP9rcHYFXbi9ke0Ft7W +živjo, ne strinjam se diff --git a/prog/skovikanje/komentarji/BIlW b/prog/skovikanje/komentarji/BIlW new file mode 100644 index 0000000..fadd384 --- /dev/null +++ b/prog/skovikanje/komentarji/BIlW @@ -0,0 +1,4 @@ +test anton $2y$10$LnlzDUVpw28twmxKeTxq8evS0iWmJct6g4NslGG/GO2QaX020pZ/q +evo tule en neobstoječ komentar
+>>abcd
+kaj porečeš, računalnik? diff --git a/prog/skovikanje/komentarji/D1B+ b/prog/skovikanje/komentarji/D1B+ new file mode 100644 index 0000000..01ac838 --- /dev/null +++ b/prog/skovikanje/komentarji/D1B+ @@ -0,0 +1,16 @@ +test anton@sijanec.eu $2y$10$1NcCaWB6Z4X4/Q8EZgdv7.pm.j9KPjJwmUJRgEvF2W785X16LhXnO +AnJicLwsogGlgfcH
+>>AnJicLws
+in druge besedi
+>>ogGlgfcH
+in druge besedi
+>>u9XDzZvP
+in druge besedi
+bye
+>lol
+* seznam
+* seznam
+bye
+kaj?
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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa diff --git a/prog/skovikanje/komentarji/N9y8 b/prog/skovikanje/komentarji/N9y8 new file mode 100644 index 0000000..27eba64 --- /dev/null +++ b/prog/skovikanje/komentarji/N9y8 @@ -0,0 +1,3 @@ +hitler anton $2y$10$ScQ6WyAO9B2ymvCigJideO0sLEKUiU1hY6EI/eQp7tzKn5klZSd5K +>>+Hxc
+wow hvala za ta gif diff --git a/prog/skovikanje/komentarji/OoTc b/prog/skovikanje/komentarji/OoTc new file mode 100644 index 0000000..9d428c0 --- /dev/null +++ b/prog/skovikanje/komentarji/OoTc @@ -0,0 +1,2 @@ +leonard Hrustljavko $2y$10$RfKVIYxTuWaQzqJdCoavQOO5NZKYy3zxYphRgVvnHKLDf/iwQ7WRO +!http://4a.si/nige diff --git a/prog/skovikanje/komentarji/QxPi b/prog/skovikanje/komentarji/QxPi new file mode 100644 index 0000000..f8129c3 --- /dev/null +++ b/prog/skovikanje/komentarji/QxPi @@ -0,0 +1,3 @@ +test gurr +>>sREUrLe2
+kekd diff --git a/prog/skovikanje/komentarji/QxPio4BC b/prog/skovikanje/komentarji/QxPio4BC new file mode 100644 index 0000000..f8129c3 --- /dev/null +++ b/prog/skovikanje/komentarji/QxPio4BC @@ -0,0 +1,3 @@ +test gurr +>>sREUrLe2
+kekd diff --git a/prog/skovikanje/komentarji/c6WY b/prog/skovikanje/komentarji/c6WY new file mode 100644 index 0000000..df514a8 --- /dev/null +++ b/prog/skovikanje/komentarji/c6WY @@ -0,0 +1,2 @@ +test bejsd $2y$10$pz8xgvSs.iOoTOuVsKz7S.8.5H2ZTnTx69C98OvkDCUj72LsvmKSO +<h onmouseover="javascript:alert(document.cookie)"> brbrbrbrbrbr br diff --git a/prog/skovikanje/komentarji/c6WYcQCT b/prog/skovikanje/komentarji/c6WYcQCT new file mode 100644 index 0000000..df514a8 --- /dev/null +++ b/prog/skovikanje/komentarji/c6WYcQCT @@ -0,0 +1,2 @@ +test bejsd $2y$10$pz8xgvSs.iOoTOuVsKz7S.8.5H2ZTnTx69C98OvkDCUj72LsvmKSO +<h onmouseover="javascript:alert(document.cookie)"> brbrbrbrbrbr br diff --git a/prog/skovikanje/komentarji/kjsX b/prog/skovikanje/komentarji/kjsX new file mode 100644 index 0000000..325899e --- /dev/null +++ b/prog/skovikanje/komentarji/kjsX @@ -0,0 +1,3 @@ +test anton@sijanec.eu $2y$10$4.Bd8gbW9idUSQ2gtvhVnek2YH3m.pa33Go5aGCZHoTwoG5y6SH3K +a ugnezdeno citiranje deluje?
+>>D1B+ra+8 diff --git a/prog/skovikanje/komentarji/ogGl b/prog/skovikanje/komentarji/ogGl new file mode 100644 index 0000000..9854e21 --- /dev/null +++ b/prog/skovikanje/komentarji/ogGl @@ -0,0 +1,2 @@ +test anton@sijanec.eu $2y$10$xt0tJQPCHu14L0U2eMA17eZ3QV0RVqhNfy2STM.yvlZsJAI0IEfei +živjo, ne strinjam se diff --git a/prog/skovikanje/komentarji/sREU b/prog/skovikanje/komentarji/sREU new file mode 100644 index 0000000..3f61265 --- /dev/null +++ b/prog/skovikanje/komentarji/sREU @@ -0,0 +1,2 @@ +test nick $2y$10$X2iymtuTKLBlCmgGD5iz.eDTRMXXhy7uqENIcEesrjw2ApSaxmmBe +>>QxPio4BC diff --git a/prog/skovikanje/komentarji/sREUrLe2 b/prog/skovikanje/komentarji/sREUrLe2 new file mode 100644 index 0000000..3f61265 --- /dev/null +++ b/prog/skovikanje/komentarji/sREUrLe2 @@ -0,0 +1,2 @@ +test nick $2y$10$X2iymtuTKLBlCmgGD5iz.eDTRMXXhy7uqENIcEesrjw2ApSaxmmBe +>>QxPio4BC diff --git a/prog/skovikanje/komentarji/smYG b/prog/skovikanje/komentarji/smYG new file mode 100644 index 0000000..3efbf18 --- /dev/null +++ b/prog/skovikanje/komentarji/smYG @@ -0,0 +1,4 @@ +test anton@sijanec.eu $2y$10$ivQR2DgDECItukMgvo5LneaRD8LCXSegmvp7wMRvkxIdWzRnBwDMG +asd
+urejen
+geslo je asd diff --git a/prog/skovikanje/komentarji/stts b/prog/skovikanje/komentarji/stts new file mode 100644 index 0000000..918308a --- /dev/null +++ b/prog/skovikanje/komentarji/stts @@ -0,0 +1,6 @@ +leonard JebešJs $2y$10$0b8QtQp5j.ai08CuECln4u4MY8ATrIcKU5afcFHhsFEaN01YzSC/O +!https://www.americanprophet.org/img/laughing-child.png
+Poženi to v js konzoli:
+smešno bo
+
+for(x of document.getElementsByTagName("img"))x.src = "//ass.si/f/xeoy4.png" diff --git a/prog/skovikanje/komentarji/tHMD b/prog/skovikanje/komentarji/tHMD new file mode 100644 index 0000000..56ba201 --- /dev/null +++ b/prog/skovikanje/komentarji/tHMD @@ -0,0 +1,8 @@ + anton@sijanec.eu $2y$10$aDJq.y9VKP4DVN5RroK1Ge49L1Sv9dyuDOCnWjvjy0NmM2sMOikQa +To je prvi testni komentar.
+Urejanje komentarja!
+Še enkrat?
+Prosim, več!
+Resno?
+ne dela. asdasd
+ojča diff --git a/prog/skovikanje/komentarji/u9XD b/prog/skovikanje/komentarji/u9XD new file mode 100644 index 0000000..a556084 --- /dev/null +++ b/prog/skovikanje/komentarji/u9XD @@ -0,0 +1,2 @@ +test anton@sijanec.eu $2y$10$O04g6s5sroYww6CWq8dIpuQBwLWNkKb8cKrSW02zOnMnzWJxEAosq +živjo, ne strinjam se diff --git a/prog/skovikanje/komentarji/uXkE b/prog/skovikanje/komentarji/uXkE new file mode 100644 index 0000000..545be7a --- /dev/null +++ b/prog/skovikanje/komentarji/uXkE @@ -0,0 +1,3 @@ + anton@sijanec.eu $2y$10$2yu9PByOKfkhyCOCgfMkNeKmnE6M0Ml8Abepaj1/CHCjpaSFbbXVO +ojla2
+urejen diff --git a/prog/skovikanje/komentarji/v5lR b/prog/skovikanje/komentarji/v5lR new file mode 100644 index 0000000..2094663 --- /dev/null +++ b/prog/skovikanje/komentarji/v5lR @@ -0,0 +1,3 @@ +chronostatis Jeffery $2y$10$j9j.il6JhuCkv7I1gSF9TeksKIwOlz5hRqpbO3CMJhi50J2frOKfq +kokr vem se i3status sinhronizira na začetek minute, tkoda je ob spremembi čas točen.
+Po drugi strani sem precej prepričan, da btop dela `delay(state.delay); refresh();`, kar bi pomenil, da je v tvojem primeru lahko do 100ms razlike diff --git a/prog/skovikanje/komentarji/xDAU b/prog/skovikanje/komentarji/xDAU new file mode 100644 index 0000000..e0b2d6a --- /dev/null +++ b/prog/skovikanje/komentarji/xDAU @@ -0,0 +1,3 @@ + anton@sijanec.eu $2y$10$QfoIcmO5n07B9AT2bNXr7ee9vdDGJShLoJijmMXbjcd4r.uZvee3a +ojla
+urejanje diff --git a/prog/skovikanje/komentarji/xezz b/prog/skovikanje/komentarji/xezz new file mode 100644 index 0000000..ec2faee --- /dev/null +++ b/prog/skovikanje/komentarji/xezz @@ -0,0 +1,3 @@ +i<3mat https://ass.si $2y$10$MaIj7CpngXWlqc3f.hlF9OVYdmR0.O53.EAsMlFG7Ta3NYDANI7Ce +Se gre na to?
+!https://ass.si/f/s9uqm.png diff --git a/prog/skovikanje/komentarji/z6nz b/prog/skovikanje/komentarji/z6nz new file mode 100644 index 0000000..6676bfb --- /dev/null +++ b/prog/skovikanje/komentarji/z6nz @@ -0,0 +1,3 @@ +test $2y$10$WbbgNY5k4ahRuKmRZkYyD.0MGHBbXtksvCmiN9/RqRRnlamROJe.y +!https://raw.githubusercontent.com/Codelessly/FlutterLoadingGIFs/master/packages/cupertino_activity_indicator_square_small.gif
+loading demo za un cursed https://ass.si link diff --git a/prog/skovikanje/objave/chronostatis b/prog/skovikanje/objave/chronostatis new file mode 100644 index 0000000..d2721cc --- /dev/null +++ b/prog/skovikanje/objave/chronostatis @@ -0,0 +1,8 @@ +Prva sekunda izgleda daljša 2023-12-03 +Poznate občutek, ko pogledate na bodisi analogno bodisi digitalno uro in se le-ta neprijetno dolgo ne spremeni, skoraj daje občutek, da je pokvarjena, ko kajkmalu le začne teči z rednimi sekundnimi intervali? Niste edini. Gre za takoimenovano časovno iluzijo, o kateri lahko preberete več na Wikipediji. Ta čutna časovna zmota ni prisotna le pri vidu, temveč tudi pri sluhu, kot navaja članek: +> This illusion can also occur in the auditory and tactile domain. For instance, a study suggests that when someone listens to a ringing tone through a telephone, while repetitively switching the receiver from one ear to the other, it causes the caller to overestimate the temporal duration between rings. +Angleški članek na Wikipediji: https://en.wikipedia.org/wiki/Chronostasis +GIF, ki prikazuje pojav: +!https://upload.wikimedia.org/wikipedia/commons/b/b2/ChronostasisTimeline.gif +Zahvaljujoč spletu je bil odgovor na moje vprašanje, zastavljeno tedaj, ko sem pojav pred desetimi minutami opazil, ko sem preverjal, če sta ura v programu za pregled poslov <code>btop</code> in ura v opravilni vrstici sinhronizirani, na hitrem dosegu roke (miške). +!http://upload.šijanec.eu./d/chronostatis.png diff --git a/prog/skovikanje/objave/hitler b/prog/skovikanje/objave/hitler new file mode 100644 index 0000000..20f82c2 --- /dev/null +++ b/prog/skovikanje/objave/hitler @@ -0,0 +1,12 @@ +Edini posnetek Hitlerjevega normalnega glasu 2023-11-30 +Skrbno izdelani javni nastopi Adolfa Hitlerja, mnogokateri ohranjeni na avdiovizuelnih posnetkih, so očarali množice. V zasebnih trenutkih pa se Hitler ni pustil snemati. Finski tonski tehnik, ki je prišel snemat Hitlerjev politično obarvan sestanek v vagonu vlaka, vendar snemalnika po uradnem delu pogovora ni izključil, je tako posnel edini znan posnetek, ko diktator govori normalno, v mirnem, nezaigranem tonu. + +Preden je SSovski stražar opazil vklopljen diktafon in preden je ukazal ustaviti snemanje in uničenje traku (ki se k sreči ni zgodilo), je finski tonski tehnik poleg uradnega dela posnel še enajst minut zasebnega pogovora med Mannerheimom in Hitlerjem, kjer slednji večinoma govori v daljših monologih, razkrivajoč Hitlerjev preprost jezik, tipičen za neizobražence. + +Za več informacij o zgodbi si lahko ogledate video "The Only Secret Recording of Hitler's Normal Voice | The Hitler-Mannerheim Recording" (objavljen 2020-11-29) v angleščini na naslovu https://www.youtube.com/watch?v=WE6mnPmztoQ + +V videu je poleg ozadja zgodbe prisotnih nekaj krajših izsekov posnetka, ki so opremljeni s prevodi v angleščini. + +Na sliki Hitler pred ogledalom vadi za svoj prihajajoči govor: +!//upload.šijanec.eu./d/hitler.jpg +Vir slike: https://rarehistoricalphotos.com/hitler-rehearsing-speech-front-mirror-1925/ diff --git a/prog/skovikanje/objave/i<3mat b/prog/skovikanje/objave/i<3mat new file mode 100644 index 0000000..1c756b6 --- /dev/null +++ b/prog/skovikanje/objave/i<3mat @@ -0,0 +1,5 @@ +Cikel poljudnih predavanj iz matematike 2023-11-26 +Na FMF bodo decembra, januarja in marca na tradicionalnem ciklu <i>Ljubim matematiko</i> govorili o teoriji grafov, numeričnem računanju integralov in o determinantah. +Več na http://www.fmf.uni-lj.si/sl/studij-matematike/I-love-mat +Fotografija promocijskega plakata: +!//upload.sijanec.eu/d/i<3mat.jpg diff --git a/prog/skovikanje/run.sh b/prog/skovikanje/run.sh index 9448f92..a3e00e7 100755 --- a/prog/skovikanje/run.sh +++ b/prog/skovikanje/run.sh @@ -1,7 +1,7 @@ #!/bin/sh while : do -./generiraj.sh rss.xml | sponge index.html +time ./generiraj.sh rss.xml | sponge index.html inotifywait -re modify -e delete . sleep .1 done diff --git a/skripti/IntsToBytes.java b/skripti/IntsToBytes.java new file mode 100644 index 0000000..bd701e0 --- /dev/null +++ b/skripti/IntsToBytes.java @@ -0,0 +1,14 @@ +import java.util.*; +public class IntsToBytes { + public static void main (String[] args) { + Scanner sc = new Scanner(System.in); + while (true) { + try { + System.out.write(sc.nextInt()); + } catch (NoSuchElementException e) { + System.out.flush(); + System.exit(0); + } + } + } +} diff --git a/skripti/prowlarr_enable_all_indexers.sh b/skripti/prowlarr_enable_all_indexers.sh new file mode 100755 index 0000000..1c6718e --- /dev/null +++ b/skripti/prowlarr_enable_all_indexers.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -xeuo pipefail +curl "$1/api/v1/indexer/schema" -H "X-Api-Key: $2" | jq -c '.[]|select(.privacy=="public")' | while read -r l +do + sed 's/"appProfileId":0,/"appProfileId":1,/' <<<$l | curl -i "$1/api/v1/indexer?" -X POST -H "Content-Type: application/json" -H "X-Api-Key: $2" --data-binary @- +done diff --git a/šola/p1/dn/Premica.java b/šola/p1/dn/Premica.java new file mode 100644 index 0000000..2d2ec4e --- /dev/null +++ b/šola/p1/dn/Premica.java @@ -0,0 +1,50 @@ +import java.util.*; +public class Premica { + private double k; + private double n; + public Premica(double k, double n) { + this.k = k; + this.n = n; + } + public double vrniK() { + return this.k; + } + public double vrniN() { + return this.n; + } + public String toString() { + return String.format(Locale.ROOT, "y = %.2f x + %.2f", this.k, this.n); + } + public Tocka tockaPriX(double x) { + return new Tocka(x, this.k*x+this.n); + } + public static Premica skoziTocko(double k, Tocka t) { + return new Premica(k, t.vrniY()-k*t.vrniX()); + } + + public Premica vzporednica(Tocka t) { + return skoziTocko(this.k, t); + } + + public Premica pravokotnica(Tocka t) { + return skoziTocko(-1/this.k, t); + } + + public Tocka presecisce(Premica p, double epsilon) { + if (Math.abs(this.k - p.vrniK()) < epsilon) + return null; + return tockaPriX((this.n-p.vrniN())/(p.vrniK()-this.k)); + } + public Tocka projekcija(Tocka t) { + return presecisce(pravokotnica(t), 0); + } + public double razdalja(Tocka t) { + return t.razdalja(projekcija(t)); + } + public double razdaljaOdIzhodisca() { + return Tocka.izhodisce().razdalja(projekcija(Tocka.izhodisce())); + } + public double razdalja(double n) { + return new Premica(this.k, n).razdalja(tockaPriX(0)); + } +} diff --git a/šola/p1/dn/Tocka.java b/šola/p1/dn/Tocka.java new file mode 100644 index 0000000..8dce30b --- /dev/null +++ b/šola/p1/dn/Tocka.java @@ -0,0 +1,27 @@ +import java.util.*; +public class Tocka { + private double x; + private double y; + public Tocka(double x, double y) { + this.x = x; + this.y = y; + } + public double vrniX() { + return this.x; + } + public double vrniY() { + return this.y; + } + public String toString() { + return String.format(Locale.ROOT, "(%.2f, %.2f)", this.x, this.y); + } + public static Tocka izhodisce() { + return new Tocka(0, 0); + } + public double razdalja(Tocka t) { + return Math.sqrt(Math.pow(this.x-t.x, 2)+Math.pow(this.y-t.y, 2)); + } + public double razdaljaOdIzhodisca() { + return izhodisce().razdalja(this); + } +} diff --git a/šola/p1/dn/tj.sh b/šola/p1/dn/tj.sh index 705db03..dcb1270 100755 --- a/šola/p1/dn/tj.sh +++ b/šola/p1/dn/tj.sh @@ -6,11 +6,17 @@ d=$3 uspelih=0 napa=0 predolg=0 -for f in $2/*.in +find $2 -name '*.java' -or -name '*.in' | while read -r f do echo -n "$f ... " uspeh=0 - out=$(timeout 5s /usr/bin/time --quiet -f %E diff --ignore-trailing-space --side-by-side <(java $1 < $f) `sed s/in$/out/ <<<$f` 2>&1) && uspeh=1 + if grep 'java$' <<<$f > /dev/null + then + stdout=`echo <(java $f)` + else + stdout=`echo <(java $1 < $f)` + fi + out=$(timeout 5s /usr/bin/time --quiet -f %E diff --ignore-trailing-space --side-by-side <(java `grep 'java$' <<<$f > /dev/null && echo $f || echo $1` <$f) `sed -e s/in$/out/ -e 's/Test\([0-9]\)/test\1/' -e s/java$/out/ <<<$f` 2>&1) && uspeh=1 koda=$? if [ $uspeh -eq 0 ] then @@ -27,6 +33,7 @@ do tac $f | tac echo "IZHOD: Levo je vaš izhod, desno je pravilen izhod:" head -n-1 <<<$out + grep 'java$' <<<$f > /dev/null && echo "PRIPOROČILO: Če DN zahteva razrede (kot recimo DN06), morate imeti v trenutnem direktoriju PREVEDENE .class datoteke vaših zahtevanih razredov. Če so v katerem drugem direktoriju, morate nastaviti CLASSPATH." fi else uspelih=$(($uspelih+1)) |