summaryrefslogtreecommitdiff
path: root/templates/partials/code/textarea.html
blob: a13ba69146a150925c6a12c664094dc8f308158a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

<textarea id="code" name="code" class="w-full">
from base64 import b64decode
from datetime import datetime
from time import sleep

# Внимание, пасхалка !
# Выполни код что бы увидеть расшифрованное сообщение
b64message = '0K3RgtC+0YIg0LrQvtC0LCDQsdGL0Lsg0LLRi9C/0L7Qu9C90LXQvSwg0L3QsCDQsdC10LrQtdC90LTQtS4='

def decode_message(b64message: str): 
    sleep(.5) #  Удали эту строку если жалко пол секунды
    return b64decode(b64message.encode()).decode('utf-8')

start_time = datetime.now()
print(f'Время начала: {start_time}')
print(decode_message(b64message))
print(f'Время выполнения: {(datetime.now() - start_time)}')
</textarea>

<script>
  document.addEventListener("DOMContentLoaded", function () {
    document.codeEditor = CodeMirror.fromTextArea(document.getElementById("code"), {
      value: "blah",
      lineNumbers: true,
      mode: "python",
      theme: "default", // Вы можете изменить тему на любую другую из доступных в CodeMirror
      indentUnit: 4,
      matchBrackets: true,
    });
    document.codeEditor.setSize('100%','100%')
  });

</script>