Skip to content

Instantly share code, notes, and snippets.

View dmitryTsatsarin's full-sized avatar

Dmitry Tsatsarin dmitryTsatsarin

View GitHub Profile
[
{
u'pk':1,
u'name':u'',
u'parent':None,
u'children':[
{
u'pk':11,
u'name':u'subcategory'
},
#!/usr/bin/python
import subprocess
import os.path
import re
import sys
#Requires dconf tool - available in Mint as dconf-cli
#run with -r argument to remove created shortcuts
~/Загрузки$ proxylocal 8000 -v --host testho2222st
I, [2015-06-30T18:19:36.285757 #17352] INFO -- : Run with options {:server_host=>"proxylocal.com", :server_port=>"8282", :local_port=>"8000", :tls=>false, :verbose=>true, :hosts=>["testho2222st"], :version=>"0.3.1"}
Connection has been terminated. Trying to reconnect...
Connection has been terminated. Trying to reconnect...
Connection has been terminated. Trying to reconnect...
Connection has been terminated. Trying to reconnect...
^C
~/Загрузки$ telnet proxylocal.com 8282
Trying 46.101.189.242...
telnet: Unable to connect to remote host: No route to host
@dmitryTsatsarin
dmitryTsatsarin / gist:76b58a3cbd6c3c7dbf55
Last active August 29, 2015 14:24
Extendent django choice. You can access by name like a dictionary
__author__ = 'dmitry'
class StatesCreator(object):
def __init__(self, states_dict):
self.states_dict = states_dict
def for_choice(self):
return tuple(zip(self.states_dict.values(), self.states_dict.keys()))
def __getitem__(self, key):
@dmitryTsatsarin
dmitryTsatsarin / .py
Last active November 27, 2015 13:44
GET /api/vendor/service_provider_user/order/<pk>/deferred-price/options
{
"count": 2,
"previous": null,
"results": [{
"pk": 5,
"label": "option1"
}, {
"pk": 6,
"label": "option2"
}],
@dmitryTsatsarin
dmitryTsatsarin / .py
Created March 4, 2016 14:43
Заменить в выделенном тексте все пробелы на нижния подчеркивания и сделать все буквы маленькими (скрипт для AutoKey)
# Enter script code
text = clipboard.get_selection()
text = text.lower().replace(' ', '_')
keyboard.send_key("<delete>")
keyboard.send_keys("%s"% text)
# 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
@dmitryTsatsarin
dmitryTsatsarin / .py
Created May 24, 2016 06:25
Fibonacci (python)
f = [1, 1]
n = 15
for i in xrange(2, n):
f.append(f[i-1]+f[i-2])
print f
@dmitryTsatsarin
dmitryTsatsarin / es.py
Created June 8, 2016 06:51
Открытие тикета по Alt-F2 в Linux
#!/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'
Дан электронный журнал. Который содержит "разделы" (содержащий заголовок, и возрастной ценз). А также "статьи" (имеет заголовок, содержание, имя автора)
Создать страницу редактора, который будет заниматься выставлением связи между статьей и разделом.
Использовать git, сделать минимум 5 коммитов.