This file contains 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 -*- | |
import re | |
from django.shortcuts import redirect | |
PREF_VAR = 'ADMIN_PER_USER_PREF' | |
ORDER_VAR = 'o' | |
FILTER_TAIL = '__exact' | |
PATH = '/admin/storage/' |
This file contains 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/env python3.5 | |
# -*- coding: utf-8 -*- | |
import functools | |
import time | |
class throttle(object): | |
u"""Ограничивает количество вызовов обёрнутой функции за указанный период времени.""" |
This file contains 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/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Implement a console script that compares speed of sequential and parallel api requests to the demo server: | |
* Take an argument – number of the requests (N). | |
* Send N requests sequentially (next requests is sent as soon as reply received) and calculate total time | |
* Send N requests in parallel and calculate total time | |
* Print both results (sequential first) and speed coefficient, how much the second way is faster than the first one |
This file contains 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/env python | |
import math | |
OUTBITS = 16 | |
BITS_PER_CYCLE = 16 | |
BITS_PER_QUARTER = BITS_PER_CYCLE - 2 | |
BITS = 8 | |
ONE = 1 << BITS | |
HALF = ONE / 2 | |
C = 70710 * ONE / 100000 |
This file contains 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/env python | |
""" | |
Install packages: | |
wajig install pylint pyflakes pep8 pychecker | |
pip install flake8 | |
""" | |
import os |
This file contains 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 -*- | |
import os | |
from datetime import timedelta | |
from django.utils import timezone | |
from django.db import models | |
from django.utils.translation import ugettext_lazy as _ | |
class Vehicle(models.Model): |
This file contains 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
# requirements: flask-restful | |
import math | |
from flask import Flask | |
from flask_restful import Resource, Api, abort, reqparse | |
app = Flask(__name__) | |
api = Api(app) |
This file contains 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/env python | |
import gtk | |
import os | |
import subprocess | |
clipboard = gtk.clipboard_get() | |
stand_info = clipboard.wait_for_contents('TEXT').data.strip().split('\n') | |
product_url = stand_info[0] |
This file contains 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/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import pwd | |
import sys | |
from datetime import datetime | |
EMAIL = u'zhevak@mail.ru' |
This file contains 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
#!/bin/bash | |
scrot ~/.i3/locker.png -e 'convert $f -blur 5x4 ~/.i3/locker-blurred.png && composite -gravity center ~/.i3/icon_100.png ~/.i3/locker-blurred.png ~/.i3/locker-composed.png' | |
rm -f ~/.i3/locker.png ~/.i3/locker-blurred.png | |
i3lock -b -i ~/.i3/locker-composed.png |