Skip to content

Instantly share code, notes, and snippets.

View dmugtasimov's full-sized avatar
🏠
Working from home

Dmitry Mugtasimov dmugtasimov

🏠
Working from home
  • Senior Python Developer freelancer
  • Moscow
View GitHub Profile
MARBLES_COUNT = 1000
STEP_SIZES = (1, 3, 14)
MAX_STEP_SIZE = max(STEP_SIZES)
MIN_STEP_SIZE = max(STEP_SIZES)
def main():
results = [None] * (MARBLES_COUNT + 1)
for win_i in range(MAX_STEP_SIZE + 1):
@dmugtasimov
dmugtasimov / run.sh
Last active January 5, 2017 19:01
Running spiders and parsers
# Before any run
python manage.py register_spiders
python manage.py register_parsers
# Run every day
python manage.py run_spider trounceflow.spiders.impl.countries.hungary.spider.HungarySpider
python manage.py run_spider trounceflow.spiders.impl.countries.indonesia.spider.IndonesiaSpider
python manage.py run_spider trounceflow.spiders.impl.countries.mexico.spider.MexicoSpider
# Run twice a week: Tuesday and Friday
@dmugtasimov
dmugtasimov / TASKS.rst
Last active December 22, 2016 23:41
Working with tasks

Choosing a task

A developer should take top unfinished task (higher priority tasks are on top) in the backlog that is assigned to him or first unsigned task if there is not any task that is assigned to him. In latter case he/she should confirm chosen task with a team leader.

Create a branch for a task

  1. Get the lastest code base from upstream:
@dmugtasimov
dmugtasimov / base.py
Created December 18, 2016 12:09
Solution to exclude base class from registry
try:
Spider
except NameError:
# Spider name is not known yet so we are either
# initializing Spider class or we are initializing
# some class that is not inherited from Spider
# This mean that we do not need to add this class
# to registry
pass
else:
# Widely adopted coding conventions
* [PEP8](https://www.python.org/dev/peps/pep-0008/)
* [PEP20](https://www.python.org/dev/peps/pep-0020/)
* [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html)
* [DRY principle](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)
* [Clean Code: A Handbook of Agile Software Craftsmanship](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882)
# Extensions, exceptions and customization
@dmugtasimov
dmugtasimov / INSTALL.rst
Last active November 17, 2016 14:44
Web Portal installation instruction
@dmugtasimov
dmugtasimov / INSTALL.rst
Last active April 27, 2022 17:15
Tryton installation instruction

This installation instrucion describes how to install Tryton Server and Client from scratch for development purposes.

  1. Create virtualenv with virtualenvwrapper:

    mkvirtualenv -p /usr/bin/python2.7 trytond
    
  2. Install Tryton Server:

    pip install trytond==4.0.4
    
sony vaio svt131b11v svt1313k1rs kernel_data_inpage_error
@dmugtasimov
dmugtasimov / debug_smptd
Created May 28, 2012 08:16
Debugging SMTP Server
sudo python -c 'import smtpd; import asyncore; smtpd.DebuggingServer(("127.0.0.1", 25), None); asyncore.loop()'