This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def snail(n, m): | |
dx, dy = 1, 0 | |
x, y = 0, 0 | |
arr = [[0] * m for _ in range(n)] | |
for i in range(1, n * m + 1): | |
print(y, x) | |
arr[x][y] = i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
a = int(sys.argv[1]) | |
s = bin(a)[2:] | |
reverse = s[::-1] | |
print('Result is %s' % int(reverse, 2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: '2.0' | |
info: | |
title: Simple API overview | |
version: v2 | |
paths: | |
/: | |
get: | |
operationId: listVersionsv2 | |
summary: List API versions | |
parameters: [{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
A python script which starts celery worker and auto reload it when any code change happens. | |
I did this because Celery worker's "--autoreload" option seems not working for a lot of people. | |
''' | |
import time | |
from watchdog.observers import Observer ##pip install watchdog | |
from watchdog.events import PatternMatchingEventHandler | |
import psutil ##pip install psutil | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page = urllib.urlopen('http://export.finam.ru/'+str(row['code'])+'_'+str(year_start)+str(month_start)+str(day_start)+'_'+str(year_end)+str(month_end)+str(day_end)+str(e)+'?market='+str(row['id_exchange_2'])+'&em='+str(row['em'])+'&code='+str(row['code'])+'&apply=0&df='+str(df)+'&mf='+str(mf)+'&yf='+str(yf)+'&from='+str(day_start)+'.'+str(month_start)+'.'+str(yf)+'&dt='+str(dt)+'&mt='+str(mt)+'&yt='+str(yt)+'&to='+str(day_end)+'.'+str(month_end)+'.'+str(yt)+'&p='+str(p)+'&f='+str(row['code'])+'_'+str(year_start)+str(month_start)+str(day_start)+'_'+str(year_end)+str(month_end)+str(day_end)+'&e='+str(e)+'&cn='+str(row['code'])+'&dtf='+str(dtf)+'&tmf='+str(tmf)+'&MSOR='+str(MSOR)+'&mstimever='+str(mstimever)+'&sep='+str(sep)+'&sep2='+str(sep2)+'&datf='+str(datf)+'&at='+str(at)) | |
print('http://export.finam.ru/'+str(row['code'])+'_'+str(year_start)+str(month_start)+str(day_start)+'_'+str(year_end)+str(month_end)+str(day_end)+str(e)+'?market='+str(row['id_exchange_2'])+'&em='+str(row['em'])+'&code='+str(row[' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee: | |
def __init__(self, name, salary = 0): | |
self.name = name | |
self.salary = salary | |
def giveRaise(self, percent): | |
self.salary = self.salary + (self.salary * percent) | |
def work(self): | |
print(self.name, "I work") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Дан электронный журнал. Который содержит "разделы" (содержащий заголовок, и возрастной ценз). А также "статьи" (имеет заголовок, содержание, имя автора) | |
Создать страницу редактора, который будет заниматься выставлением связи между статьей и разделом. | |
Использовать git, сделать минимум 5 коммитов. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import sys | |
import subprocess | |
if len(sys.argv)>1: | |
ticket_number = sys.argv[1] | |
subprocess.check_output("google-chrome https://leverxeu.atlassian.net/browse/EESP01-%s" % ticket_number, shell=True) | |
else: | |
print 'Need to put number of ticket' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = [1, 1] | |
n = 15 | |
for i in xrange(2, n): | |
f.append(f[i-1]+f[i-2]) | |
print f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
#Задание 1 | |
#Даны числа a и b (a < b). Выведите сумму всех натуральных чисел от a до b (включительно). | |
while True: | |
print("Условие: a < b") | |
a = int(input("Введите число а: ")) | |
b = int(input("Введите число b: ")) | |
if a < b: | |
s = 0 |
NewerOlder