Skip to content

Instantly share code, notes, and snippets.

View dmitryTsatsarin's full-sized avatar

Dmitry Tsatsarin dmitryTsatsarin

View GitHub Profile
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")
@dmitryTsatsarin
dmitryTsatsarin / .py
Created July 28, 2017 15:56
Python говнецо
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['
@dmitryTsatsarin
dmitryTsatsarin / start-celery-for-dev.py
Created September 20, 2018 10:15 — forked from chenjianjx/start-celery-for-dev.py
A python script which starts celery worker and auto reload it when any code change happens.
'''
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
@dmitryTsatsarin
dmitryTsatsarin / .yaml
Created October 2, 2018 10:31
Swagger 2.0 example
swagger: '2.0'
info:
title: Simple API overview
version: v2
paths:
/:
get:
operationId: listVersionsv2
summary: List API versions
parameters: [{
import sys
a = int(sys.argv[1])
s = bin(a)[2:]
reverse = s[::-1]
print('Result is %s' % int(reverse, 2))
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