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
# -*- coding: utf-8 -*- | |
import argparse | |
import re | |
import requests | |
from bs4 import BeautifulSoup, Comment | |
from flask import Flask | |
from flask import Response |
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 | |
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 |
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 -*- | |
""" | |
python who_faster.py | |
step 1 | |
check_list 5.89978313446 | |
check_set 0.0123991966248 | |
check_dict 0.063777923584 | |
step 2 |
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 | |
# -*- coding: utf-8 -*- | |
""" | |
Implement a console script that solves the standard Queens puzzle: | |
* Take an argument – size of the board (N). | |
* Place N chess queens on an N×N chessboard so that no two queens threaten each other. | |
* Print the number of possible solutions. | |
* Print the time that was required to solve the problem. |