Skip to content

Instantly share code, notes, and snippets.

View diyan's full-sized avatar

Oleksii Diian diyan

View GitHub Profile
@diyan
diyan / flask_metrology.py
Last active August 29, 2015 13:56
Flask extension that collects metrics using Metrology and push them to Graphite
#NOTE This is alpha quality code. Works only on my workstation.
#NOTE Some details looks weird becase code is ported from my FlaskScales extension with minimal changes
from __future__ import unicode_literals
import os
import socket
from urlparse import urlparse
import logging
from flask import _request_ctx_stack
from flask.signals import got_request_exception, request_started, request_finished, template_rendered
from astrolabe import Interval
@diyan
diyan / selenium_patch.py
Created March 31, 2014 08:45
Selenium WebDriver monkey patch for using any CSS selector that jQuery supports.
"""
Selenium WebDriver monkey patch for using any CSS selector that jQuery supports.
Useful urls:
Inject the Sizzle CSS selector library. Selenium WebDriver - http://selenium.polteq.com/en/injecting-the-sizzle-css-selector-library/
Adding the Sizzle CSS Selector library in WebDriver - http://seleniumtestingworld.blogspot.com/2013/01/adding-sizzle-css-selector-library-and.html
"""
from __future__ import unicode_literals
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
@diyan
diyan / Dockerfile
Last active August 29, 2015 14:00
Dockerfile for Riak test server. Rekon installed, HTTP / Protocol Buffers, Riak Search, LevelDB backend are enabled
FROM ubuntu:14.04
MAINTAINER Alexey Diyan alexey.diyan@dev-pro.net
### NOTE. Command ./run.sh will rebuild this container
### OS. Apply Docker workarounds, update the APT cache
# http://crosbymichael.com/dockerfile-best-practices-take-2.html
ENV LC_ALL C.UTF-8
ENV DEBIAN_FRONTEND noninteractive
RUN echo 'root:root' | chpasswd
@diyan
diyan / python_web_trends.md
Created August 11, 2014 17:11
Python. Popularity of WSGI and Web frameworks
@diyan
diyan / go_loggers.md
Last active August 29, 2015 14:17
I've used strucutred logging approach in Python with structlog library. Now looking for similar options in Golang.

I've used strucutred logging approach in Python (with structlog library).

Now looking for same options but in Golang.

Candidates are logxi, log15 and logrus.

IMO log15 has most idiomatic API while logxi is most convenient (due to stack context info)

To build and run I'm using following:

Python. SOAP services

SOAP services. Overview

Evaluating Tools for Developing with SOAP in Python. Doug Hellmann - http://doughellmann.com/2009/09/01/evaluating-tools-for-developing-with-soap-in-python.html

What's the best SOAP client library for Python, and where is the documentation for it? - http://stackoverflow.com/questions/206154/whats-the-best-soap-client-library-for-python-and-where-is-the-documentation-f

What's the best SOAP library for Python 3.x? - http://stackoverflow.com/questions/7817303/whats-the-best-soap-library-for-python-3-x

@diyan
diyan / gist:1561460
Created January 4, 2012 18:57
PyLint configuration for one of our Python project
[MESSAGES CONTROL]
# Disable the following messages:
# C0111: Missing docstring. Used when a module, function, class or method has no docstring.
# Some special methods like __init__ doesn't necessary require a docstring.
# R0903: Too few public methods (%s/%s). Used when class has too few public methods, so be sure it's really worth it.
# W0232: Class has no __init__ method. Used when a class has no __init__ method, neither its parent classes.
# R0201: Method could be a function. Used when a method doesn't use its bound instance, and so
# could be written as a function.
# W0511: Used when a warning note as FIXME or XXX is detected.
@diyan
diyan / gist:1572015
Created January 6, 2012 19:27
Pre and Post build action for .NET/COM component which will be used in Classic ASP application
echo NOTE that right now pre build action will be executed...
@echo off
set APP_CMD="C:\Windows\System32\inetsrv\AppCmd.exe"
echo STEP 1. Recycle IIS 7 Application Pool named SomeAppPool because it may locked .NET assembly with COM component
%APP_CMD% recycle apppool /apppool.name:SomeAppPool
===============================================================================================
echo NOTE that right now post build action will be executed...
@diyan
diyan / gist:1627530
Created January 17, 2012 17:09
ServiceStack.Redis benchmarks
**Workstation with Intel Core i5 (3.2 GHz, dual core) CPU, 8 GB RAM**
**Test #1. ServiceStack.Redis load test. This C# client shown results better than BookSleeve library.**
1.000.000 records (1 thread) - 00:00:31 (Server RAM - 365,152 K; Client RAM - 34,596 K)
1.000.000 records (32 thread) - 00:00:15 (Server RAM - 364,664 K; Client RAM - 39,512 K)
10.000.000 records (1 threads) - 00:05:50 (Server RAM - 3,608,376 K; Client RAM - 69,960 K)
10.000.000 records (32 threads) - 00:03:00 (Server RAM - 3,609,368 K; Client RAM - 76,963 K)
@diyan
diyan / gist:1844503
Created February 16, 2012 12:25
Tools and libraries which I prefer to use in .NET stack

Tools and libraries which I prefer to use in .NET stack:

Development Tools:
  • Git / Jenkins CI / Redmine
  • Visual Studio 2010 / ReSharper for .NET/C# coding
  • Jet Brains PyCharm for Python coding
Environment:
  • .NET 4.0 / MySQL
  • Amazon EC2 / Amazon RDS (works on top of MySQL)