Skip to content

Instantly share code, notes, and snippets.

View jag-k's full-sized avatar
Make a Weather in OpenWeather

Jag_k jag-k

Make a Weather in OpenWeather
View GitHub Profile
@jag-k
jag-k / Hierarchy
Created November 13, 2017 14:22
Позволяет создать упорядочную структуру папок (Для Я.Лицея)
import os
LESSONS = 14
SW = [7, 12]
TW = []
LESSON_TYPES = ['AW', 'HW', 'CW', 'Test']
sw_count = 0
tw_count = 0
@jag-k
jag-k / Sort File
Created November 13, 2017 17:49
Ещё одна "очень" нужная программа
import os
import shutil
files = sorted(filter(lambda x: os.path.isfile(x) and x.endswith('.py'), os.listdir()))
var = {'a': 'AW', 't': 'Test', 's': 'SW', 'test': 'TW', 'h': 'HW', 'c': 'CW'}
moved_files = []
for i in files:
try:
file = i.rstrip(').py').split('(')[1].lower()
@jag-k
jag-k / searchCoordsVector.py
Created November 22, 2017 14:06
Введите уравнение для поиска вектора v, затем введите координаты векторов через пробел по одному вектору. Вывод: координаты вектора v
class Vector:
def __init__(self, x, y):
self.x, self.y = x, y
def __mul__(self, other):
if type(other) is not Vector:
return Vector(self.x * other, self.y * other)
else:
return Vector(self.x * other.x, self.y * other.y)
sockets = int(input()) # in range(1, 1016)
appliances = int(input()) # in range(1, 1016)
to2 = int(input()) # in range(1, 1001)
to5 = int(input()) # in range(1, 1001)
def rec_max(socket, numb=0):
return numb if numb*socket >= appliances else rec_max(socket, numb+1)
sockets = int(input()) # in range(1, 1016)
appliances = int(input()) # in range(1, 1016)
to2 = int(input()) # in range(1, 1001)
to5 = int(input()) # in range(1, 1001)
def rec_max(socket, numb=0):
if numb * socket >= appliances:
return numb
return rec_max(socket, numb+1)
@jag-k
jag-k / test.py
Created December 5, 2017 18:49
"Loader"
# /usr/bin/python3.6
import os, time
while True:
for i in list("▀▐▄▌"):
os.system("clear")
print(i)
time.sleep(0.3)
from sys import stdout
from time import sleep
for i in range(1, 101):
stdout.write("\r%d%%" % i)
sleep(.2)
stdout.write("\r\r")
@jag-k
jag-k / course.json
Created January 4, 2018 10:03
Курс валют)
{
"date": {
"day": 4,
"month": 1,
"year": 2018
},
"course": [
{
"id": "R01010",
"num_code": 36,
import os
from time import asctime, time
file_log = os.getcwd()+'/.log'
with open(file_log, 'w', encoding='utf-8') as file:
file.write(asctime()+'\n')
HOME = os.getcwd()
ROOT = os.path.abspath(os.getcwd()).split('/')[0]+'/'
os.chdir(ROOT)
def full_copy(l):
return [full_copy(i) if type(i) is list else i for i in list(l)]
if __name__ == '__main__':
t1 = [1, [2], [[3]]]
t2 = full_copy(t1)
t2[1].append(0)
t1[2][0].append(5)
print(t1, t2, sep='\n')