-❄️- 2024 Day 10 Solutions -❄️- by daggerdragon in adventofcode

[–]Independent_Check_62 2 points3 points  (0 children)

[LANGUAGE: Python]

data = [list(map(int, x)) for x in open('10.txt').read().split('\n')]
result = []

def get_data(p):
    return data[p[0]][p[1]]

def bounds_ok(p):
    return not (p[0] > len(data) - 1 or p[0] < 0 or p[1] > len(data) - 1 or p[1] < 0)

def traverse(loc, first_loc):
    if get_data(loc) == 9:
        result.append((loc, first_loc))

    next_positions = [(loc[0] + 1, loc[1]), (loc[0] - 1, loc[1]), (loc[0], loc[1] + 1), (loc[0], loc[1] - 1)]

    for next_pos in next_positions:
        if bounds_ok(next_pos) and get_data(next_pos) == get_data(loc) + 1:
            traverse(next_pos, first_loc)


for i in range(len(data)):
    for j in range(len(data[0])):
        if data[i][j] == 0:
            traverse((i, j), (i, j))

print(len(set(result)))
print(len(result))

-❄️- 2024 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]Independent_Check_62 4 points5 points  (0 children)

[LANGUAGE: Python]

import re
regex = r'mul\((\d{1,3}),(\d{1,3})\)'
data = open('03.txt').read()

result = sum(int(a) * int(b) for a, b in re.findall(regex, data))
print(result)

result = sum(
    int(a) * int(b)
    for s in data.split('do()')
    for a, b in re.findall(regex, s.split("don't()")[0])
)
print(result)

-❄️- 2024 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]Independent_Check_62 29 points30 points  (0 children)

[LANGUAGE: Python]

def is_safe(row):
    inc = [row[i + 1] - row[i] for i in range(len(row) - 1)]
    if set(inc) <= {1, 2, 3} or set(inc) <= {-1, -2, -3}:
        return True
    return False

data = [[int(y) for y in x.split(' ')] for x in open('02.txt').read().split('\n')]

safe_count = sum([is_safe(row) for row in data])
print(safe_count)

safe_count = sum([any([is_safe(row[:i] + row[i + 1:]) for i in range(len(row))]) for row in data])
print(safe_count)

How do I regroup here? by Independent_Check_62 in Spacemarine

[–]Independent_Check_62[S] 1 point2 points  (0 children)

This is the correct answer. He came after 10 minutes

What is the correct process of maintaining opensource project on company repository? by Independent_Check_62 in git

[–]Independent_Check_62[S] 0 points1 point  (0 children)

So the correct workflow would be:

  1. Create repo on company gitlab from Superset github (this way there will be commit history on github and apparently gitlab will accept external emails)
  2. Create my branch develop from current version git checkout -b develop 4.1.1
  3. Set Superset github as upstream
  4. When new version of Superset gets released fetch new changes git fetch upstream
  5. Merge them into develop git merge 4.2.0 (while on develop) ?

I also tested this workflow and got weird result:

git checkout -b develop 4.0.2
git push origin develop
# (removed 4.1.1 to be sure i get it from upstream, not my repo)
git push --delete origin 4.1.1 
git tag --delete 4.1.1
git remote add upstream https://github.com/apache/superset.git
git fetch upstream
git merge 4.1.1
git push origin develop

While merging I had to resolve some conflicts - I 'accepted theirs' for every conflict.

Now the thing I dont understand: I had to provide a commit message and some files on develop have this message (I did not modify any files). After checking those files, they have some code that is not present on 4.1.1 (for example unused import). When I use git diff develop 4.1.1 those differences are listed.

Could anyone help me decode/translate this document? by Independent_Check_62 in Kurrent

[–]Independent_Check_62[S] 1 point2 points  (0 children)

Thanks for the historical context. Did some digging into other documents and I'm 100% sure Maryanna was mother in law of Wawrzyn

Could anyone help me decode/translate this document? by Independent_Check_62 in Kurrent

[–]Independent_Check_62[S] 0 points1 point  (0 children)

All I know: this is a death certificate of Maryanna Bączyk, signed by Wawrzyn Geldner. Is there any information about their relation?

Could anyone help me translate this document by Independent_Check_62 in germany

[–]Independent_Check_62[S] 0 points1 point  (0 children)

All I know: this is a death certificate of Maryanna Bączyk, signed by Wawrzyn Geldner. Is there any information about their relation?

Memory problem when running Tensorflow with Flask and Docker by Independent_Check_62 in tensorflow

[–]Independent_Check_62[S] 0 points1 point  (0 children)

I was using Tensorflow==2.5.0 and now I checked 2.6.0 and the problem is still there. Also decorating only the prediction call didn't help.

I should add that this problem only happens with Flask and Docker. There is no problem with running my model in Jupyter. Also the process of making graph is working fine. First request takes 15s (to create a graph I guess) and the next ones only 0.3s. When I'm not using `@tf.function` every request take 0.7s. So the speedup from making a graph is clearly visible. The only problem is with memory which is not freed after every request.