Skip to content

Instantly share code, notes, and snippets.

View AndreiPashkin's full-sized avatar

Andrew Pashkin AndreiPashkin

  • Warsaw
  • 23:07 (UTC -12:00)
View GitHub Profile
@AndreiPashkin
AndreiPashkin / gist:9703843
Created March 22, 2014 09:40
Proof of concent for usage of pymorphy for Django admin russian translation
# coding=utf-8
import pymorphy2
morph = pymorphy2.MorphAnalyzer()
verbose_name = u'Статья'
p = morph.parse(verbose_name)[0]
print(
@AndreiPashkin
AndreiPashkin / gist:2292aa9a53154217ff39
Created May 21, 2014 19:18
Issue with locale during postgresql installation on Ubuntu 12
$ sudo apt-get install postgresql postgresql-contrib python-psycopg2 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libossp-uuid16 libpq5 libxslt1.1 postgresql-9.1 postgresql-client-9.1
postgresql-client-common postgresql-common postgresql-contrib-9.1
python-egenix-mxdatetime python-egenix-mxtools ssl-cert
Suggested packages:
uuid oidentd ident-server locales-all postgresql-doc-9.1 libdbd-pg-perl
commit 84a68f9be8e2af8d1c019fccb2d61eee05dd92d9
Author: Tierzov Andrii <avtierzov@gmail.com>
Date: Wed May 7 18:07:33 2014 +0300
#422 - Добавлены поля в форму и соответствующая модель.
commit 926e896ca2c36c5587b0c6fd65172101925df326
Author: Pashkin <andrew.pashkin@gmx.co.uk>
Date: Wed Jun 4 11:20:17 2014 +0400
Revert "#522 - Добавлены поля в форму и соответствующая модель."
@AndreiPashkin
AndreiPashkin / client.py
Last active January 7, 2020 17:08
Python asyncio coroutines pipelining and exception propagation sandbox
#!/usr/bin/env python
# coding=utf-8
"""Client that demonstrates processing pipeline."""
import asyncio
from functools import partial
import logging
logging.basicConfig(level='DEBUG')
@AndreiPashkin
AndreiPashkin / bare_vs_task_py34.py
Last active August 29, 2015 14:10
Bare coroutine vs Task
#!/usr/bin/env python
# coding=utf-8
import asyncio
import time
@asyncio.coroutine
def coro():
while True:
print('I\'m running!')
@AndreiPashkin
AndreiPashkin / Dockerfile
Created December 18, 2014 07:58
Docker cache tests
FROM ubuntu:14.04
MAINTAINER Andrew Pashkin <andrew.pashkin@gmx.co.uk>
RUN apt-get -y update
RUN apt-get install -y software-properties-common
RUN apt-add-repository -y ppa:ansible/ansible
RUN apt-get -y update
RUN apt-get install -y ansible
$ sudo apt-get -y install postgresql-plpython-9.4
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libgeos-3.2.2
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
postgresql-9.4 postgresql-contrib-9.4
Suggested packages:
@AndreiPashkin
AndreiPashkin / stack_trace.txt
Created August 12, 2015 09:03
Example of Python traceback
Traceback (most recent call last):
File "traceback_print_exc.py", line 20, in <module>
produce_exception()
File "/Users/dhellmann/Documents/PyMOTW/src/PyMOTW/traceback/traceback_example.py", line 16, in produce_exception
produce_exception(recursion_level-1)
File "/Users/dhellmann/Documents/PyMOTW/src/PyMOTW/traceback/traceback_example.py", line 16, in produce_exception
produce_exception(recursion_level-1)
File "/Users/dhellmann/Documents/PyMOTW/src/PyMOTW/traceback/traceback_example.py", line 18, in produce_exception
raise RuntimeError()
RuntimeError
$ PATH=$(pwd)/build:$PATH valgrind --read-var-info=yes --vgdb=yes --leak-check=full tests
==20285== Memcheck, a memory error detector
==20285== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==20285== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==20285== Command: tests
==20285==
Running "test_pool_alloc"...
Running "test_pool_realloc"...
Running "test_arraylist_append"...
Running "test_arraylist_append_many"...
From 4caf15883b8a892aca26aa8aaa0d40663f9cca82 Mon Sep 17 00:00:00 2001
From: Andrew Pashkin <andrew.pashkin@gmx.co.uk>
Date: Tue, 12 Apr 2016 11:13:03 +0300
Subject: [PATCH] Add a test for loading classes from modules
---
tests/integration/loader/loader.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tests/integration/loader/loader.py b/tests/integration/loader/loader.py