<code lang="html">
<!DOCTYPE html>
<html>
<body>
<h2>My Hell looper</h2>
<button type="button" id="stopBtn">STOP THIS!!!</button>
<p id="counter"></p>
<p id="demo"></p>
<script>
let counter = 0, keepLooping = true;
const htmlCounter = document.getElementById("counter");
const step = () => {
console.log(counter++);
htmlCounter.innerHTML = counter;
}
const loop = () => {
if (!keepLooping) {
htmlCounter.innerHTML = `stopped at ${counter} step by click!`;
return;
}
step();
setTimeout(loop, 1000);
}
const btn = document.getElementById("stopBtn");
btn.onclick = function(){
keepLooping = false;
}
/*START HELL*/
loop();
</script>
</body>
</html>
</code>
const gmExample = {
"south": 43.106491921792255,
"west": 76.71745650634767,
"north": 43.4065384633472,
"east": 77.13974349365236
};
const dgExample= {
"northEast": [
76.92894332280319,
43.25695003829279
],
"southWest": [
76.92825667730312,
43.256449960663694
]
};
const gm = {
"south": dgExample.southWest[1],
"west": dgExample.southWest[0],
"north": dgExample.northEast[1],
"east": dgExample.northEast[0]
};
const dg = {
"northEast": [
gmExample.east,
gmExample.north
],
"southWest": [
gmExample.west,
gmExample.south
]
};
class CompatibleBounds {
northEast = [0, 0];
southWest = [0, 0];
constructor(bounds) {
Object.assign(this, bounds);
}
static new(bounds) {
return new this(bounds);
}
get south(){ return this.southWest[1] }
get west(){ return this.southWest[0] }
get north(){ return this.northEast[1] }
get east(){ return this.northEast[0] }
set south(value){ this.southWest[1] = value }
set west(value){ this.southWest[0] = value }
set north(value){ this.northEast[1] = value }
set east(value){ this.northEast[0] = value }
}
const compatibleBounds = CompatibleBounds.new({
"south": 43.106491921792255,
"west": 76.71745650634767,
"north": 43.4065384633472,
"east": 77.13974349365236
});
// или
const compatibleBounds = CompatibleBounds.new({
"northEast": [
76.92894332280319,
43.25695003829279
],
"southWest": [
76.92825667730312,
43.256449960663694
]
});
// на выходе универсальный динамический объект:
compatibleBounds.southWest = [1, 2];
console.log(compatibleBounds.south); // 2
compatibleBounds.south = 3
console.log(compatibleBounds.southWest); // [1, 3]
import winreg
# Добавляем в автозагрузку
def add_to_startup(program_name, executable_path):
# Реестр
registry_path = winreg.HKEY_CURRENT_USER
key_path = r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run'
try:
# Открываем ключ реестра для записи
with winreg.OpenKeyEx(registry_path, key_path, 0, winreg.KEY_WRITE) as registry_key:
# Создание или обновление реестра
winreg.SetValueEx(registry_key, program_name, 0, winreg.REG_SZ, executable_path)
print(f"{program_name} добавлена в автозагрузку.")
except PermissionError:
print("Нужны админские права.")
# Проверка программы в автозагрузке
def check_startup_entry(program_name):
registry_path = winreg.HKEY_CURRENT_USER
key_path = r'SOFTWARE\Microsoft\Windows\CurrentVersion\Run'
try:
# Открываем ключ реестра для чтения
with winreg.OpenKeyEx(registry_path, key_path, 0, winreg.KEY_READ) as registry_key:
program_path, regtype = winreg.QueryValueEx(registry_key, program_name)
print(f"{program_name} уже добавлена в автозагрузку с путем: {program_path}")
except FileNotFoundError:
print(f"{program_name} не найдена в автозагрузке.")
if __name__ == "__main__":
program_name = "GodzillaSoft"
program_path = r"C:\path\GodzillaSoft.exe"
check_startup_entry(program_name)
add_to_startup(program_name, program_path)
list1 = list('abcdef')
list2 = list('klmnop')
list3 = list('uvwxyz')
for item1, item2, item2 in zip(list1, list2, list3):
print(item1, item2, item2)
import itertools
list1 = list('abcdef')
list2 = list('klmnop')
list3 = list('uvwxyz')
for item in itertools.chain(list1, list2, list3):
print(item)
import itertools
list1 = list('abcdef')
list2 = list('klmnop')
list3 = list('uvwxyz')
for item1, item2, item3 in itertools.product(list1, list2, list3):
print(item1, item2, item3)