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)
.pic {
display: inline-block;
}
.pic img {
opacity: 1;
transition: opacity 1s linear;
}
.pic img.invisible {
opacity: 0;
}
button {
padding: 1em;
}
button.active {
background: tomato;
}
document.body.addEventListener('click', e => {
if (!e.target.matches('button')) return
const img = document.querySelector('.pic img')
img.classList.add('invisible')
img.ontransitionend = () => {
img.onload = () => img.classList.remove('invisible')
img.src = e.target.dataset.src
document.querySelectorAll('button').forEach(btn => btn.classList.remove('active'))
e.target.classList.add('active')
}
})