0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
from miditk.smf import MidiSequence
from miditk.common import constants
from sys import argv
import datetime
sequence = MidiSequence.fromfile(argv[1])
dt0 = datetime.datetime(1,1,1)
tail = ''
for time, group in sequence.events_by_time():
ms = datetime.timedelta(milliseconds=time)
pretty_time = (dt0+ms).strftime('%M:%S.%f')[:-4]
for ev in group:
if ev.meta_type == constants.TEXT:
text = ev.data.decode('windows-1251')
if text and (text[0] == '@' or text[0] == '/' or text[0] == '\\'):
if tail: # выводим отложенный текст
if tail[0] == '\\': # отбиваем абзац
print(f'[{pt}]')
if tail[0] == '@': # шапка, убираем префиксы типа @T, @L
print(f'[{pt}]{tail[2:]}')
else:
print(f'[{pt}]{tail[1:]}')
pt = pretty_time
tail = text
else: # откладываем текст на потом
tail = tail + text
Наговнякал на коленках конь-вертер текстов песен из .KAR (.midi со словами в событиях типа 1 = TEXT) в .LRC, чтобы готовые тексты можно было использовать с проигрывателями mp3- или flac-файлов.
Зависит от https://pypi.org/project/miditk-smf/
ropuJIJIa,
12 Апреля 2023
−1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
def get_decrease_fan_speed_delta(fan_speed: float, delta: float, turn_off: bool):
# if the fan is already running slower than minimum speed
if fan_speed < MIN_FAN_SPEED:
# we ignore the turn_off argument and always set the fan off
return -fan_speed
# if fan would be running slower than minimum speed after decreasing it by delta:
if (fan_speed - delta) < MIN_FAN_SPEED:
if turn_off:
return -fan_speed # turn the fan off
else:
return -fan_speed + MIN_FAN_SPEED # make it run at minimum speed
return -delta
def get_increase_fan_speed_delta(fan_speed, delta):
new_fan_speed = fan_speed + delta
# if fan would be running faster than maximum speed
if new_fan_speed > 100:
return 100 - fan_speed # cap it at 100%
elif new_fan_speed < MIN_FAN_SPEED:
return MIN_FAN_SPEED - fan_speed # jump to minimum fan speed
return delta
def compute_fan_speed_delta(temp: float, temp_delta: float, fan_speed: float):
if temp >= HOT:
return get_increase_fan_speed_delta(fan_speed, 100.0)
if temp <= COLD:
# if temperature is decreasing, we slowly decrease the fan speed
if temp_delta < 0.0:
return get_decrease_fan_speed_delta(fan_speed, FAN_DELTA, turn_off=True)
# if temperature is constant or increasing we don't change fan speed
# until it rises above COLD
return 0.0
# if temperature is decreasing we decrease fan speed slowly
if temp_delta < 0.0:
return get_decrease_fan_speed_delta(fan_speed, FAN_DELTA, turn_off=False)
# if temperature is increasing we increase fan speed slowly
if temp_delta > 0.0:
return get_increase_fan_speed_delta(fan_speed, FAN_DELTA)
# if temperature is not changing, don't change the fan speed
return 0.0
GAMER,
30 Марта 2023
0
- 1
https://gitlab.com/muzena/iptv/-/blob/master/usr/lib/astronciaiptv/astroncia_iptv.py
тут каждая строчка - это говнокод
ACTPE9I,
27 Марта 2023
0
- 1
AttributeError: type object 'datetime.datetime' has no attribute 'from_timestamp'. Did you mean: 'fromtimestamp'?
ISO,
19 Марта 2023
−8
правда
sashastepuronegro,
04 Марта 2023
−8
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
print('1 часть тут, 2 в описании')
import re
q = int(input())
b = input()
v = 0
flag = True
if v == 0:
c = len(re.findall('q', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('w', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('e', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('r', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('t', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('y', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('u', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('i', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('o', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('p', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('a', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('s', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('d', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('f', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('g', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('h', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('j', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('k', b))
if c > 1:
print("NO")
flag = False
quit
else:
v = 3
c = len(re.findall('l', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('m', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('n', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('b', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('v', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('c', b))
if c > 1:
print("NO")
flag = False
quit()
else:
v = 3
c = len(re.findall('x', b))
if c > 1:
flag = False
quit()
print("NO")
else:
v = 3
c = len(re.findall('z', b))
if c > 1:
flag = False
print("NO")
quit()
else:
v = 3
if flag == True:
print("YES")
sashastepuronegro,
04 Марта 2023
−1
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
def auth_2FA(request):
mail = request.POST.get('mail')
user = User.objects.get(email=mail)
code2FA = request.POST.get('code2FA')
if pyotp.TOTP(user.secret).verify(code2FA):
auth.login(request, user)
return redirect(settings.HOME_PAGE)
else:
...
# Безопасность
Django, двухфакторка.
Защиты от перебора нет, пароль не проверяется. Зная только mail можно залогиниться перебрав код из 6 цифр
Doorman5302,
01 Марта 2023
0
- 1
print(str(n := int(input())) * 0, sum([(-1) ** i * 1 / (2 ** i) for i in range(n)]), sep='')
fec60394,
04 Февраля 2023
0
- 1
print(str(n := int(input())) * 0, sum([(-1) i * 1 / (2 i) for i in range(n)]), sep='')
Сократил xD
fec60394,
04 Февраля 2023
−2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
key_base_len = random.randint(30,61)
key_base = bytearray(key_base_len)
for i in range(key_base_len):
key_base[i] = random.randint(0,255)
key = bytearray(8)
key[0] = chip_uid_chksum ^ key_base[ 4 * (key_base_len // 7)]
key[1] = chip_uid_chksum ^ key_base[ key_base_len // 5 ]
key[2] = chip_uid_chksum ^ key_base[ key_base_len // 7 ]
key[3] = chip_uid_chksum ^ key_base[ 6 * (key_base_len // 7)]
key[4] = chip_uid_chksum ^ key_base[ 3 * (key_base_len // 7)]
key[5] = chip_uid_chksum ^ key_base[ 3 * (key_base_len // 5)]
key[6] = chip_uid_chksum ^ key_base[ 5 * (key_base_len // 7)]
key[7] = (chip_id + key[0]) & 0xff
return key, key_base
Китайцы и криптография.
Сначала программатор отдаёт контроллеру key_base, а затем юзает key чтобы ксорить с ним заливаемую прошивку.
bormand,
31 Декабря 2022