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 | |
from cian_statprof.profiler import Profiler | |
from cian_statprof.sampler import Sampler | |
profiler = Profiler(Sampler(), Logger(), {'is_enabled': True}) | |
class StatisticalProfilerMiddleware(object): | |
def process_request(self, request): |
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 threading | |
import time | |
from collections import deque | |
from datetime import datetime | |
from functools import wraps | |
from django.utils.encoding import smart_text | |
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 collections import defaultdict, deque | |
from statsd.client import StatsClient, Timer | |
class Prof(object): | |
"""Инструмент для профилирования времени исполнения кода в контексте | |
HTTP-запроса или команды. |
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
from django.contrib.syndication.views import Feed | |
from django.views.generic import View | |
class FeedView(View, Feed): | |
def get(self, request, *args, **kwargs): | |
return self(request, *args, **kwargs) |
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
class Item extends Backbone.Model | |
initialize: -> | |
@variants = new Backbone.Collection(@get('variants')) | |
class Items extends Backbone.Collection | |
url: '/api/items' | |
model: Item | |
parse: (response) -> response.objects |
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
@pytest.mark.parametrize(('uri', 'method', 'expected'), [ | |
('/api/user', 'GET', True), | |
('/api/user/syncs', 'POST', True), | |
('/api/user/hooks', 'GET', True), | |
('/api/user/hooks/1', 'PATCH', True), | |
('/api/user/repos', 'GET', True), | |
]) | |
def test_requires_auth(app, uri, method, expected): | |
with app.test_client() as client: | |
response = client.open(uri, method=method) |
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
Commit: | |
- id | |
- hash | |
- ref | |
- compare_url | |
- committer_name | |
- committer_email | |
- message | |
Push 1: |
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
project: | |
nginx_site: | |
- managed | |
- source: salt://projects/files/nginx_site_config | |
- enable: true | |
- require: | |
- service: nginx |
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
git clone https://github.com/collective/buildout.python ~/.pythons | |
cd ~/.pythons | |
python bootstrap-1.4.4.py --distribute | |
./bin/buildout |
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/sh | |
if [ ! $1 ]; then | |
echo "Error: project name is not specified." | |
exit 1 | |
fi | |
PROJECT_NAME="$1" | |
SESSION_NAME=${PROJECT_NAME//\./-} | |
PROJECT_PATH="$PROJECT_HOME/$PROJECT_NAME" |
NewerOlder