This file contains hidden or 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 | |
""" | |
Quick, dirty and insecure tool to extract certificate info and private key | |
from the PKCS#12 certicate and dump it to separate files in PEM format | |
(because openssl command-line tool is a mess) | |
Usage: p12_to_pem path/to/file.p12 password | |
""" | |
import os |
This file contains hidden or 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 notes__ | |
[[NOTE]]: - We use colors (priorities) to mark the complexity of the task - It's okay to change the complexity on the task, as you work on it - We use a flow where tasks "bubble up" from the backlog to done - Depending on the project, you may have more (or less, without "testing", for instance) stages of the flow - One may or may not use tags | |
...Trivial. It's barely worth creating a separate item | |
...Easy. No hidden pitfalls, straightforward execution flow, short time to work [[priority 3]] | |
...Hard. Challenging. Pitfalls expected. Or just long and boring [[priority 2]] | |
...Super-hard. But you're not scared. Subtasks required [[priority 1]] | |
* !!Done!! | |
[[NOTE]]: Move all completed tasks here. They pass the testing phase and are in production, or ready to production. Tasks have to be stricken through | |
...Trivial task @feature | |
...Serious bug [[priority 2]] |
This file contains hidden or 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
""" | |
Generator and Releaser objects which could be used to create and destroy | |
objects in separate threads. Generator constantly keeps the pool of N objects | |
to use by the test function (by default N equals to 1). | |
How to use them: | |
You create a session-scope generator and releaser. They are subclasses | |
of threading.Thread, so you should start them as well. |
This file contains hidden or 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 argparse | |
import shlex | |
import subprocess | |
import time | |
def get_arguments(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-p', '--period', type=int, default=30) |
This file contains hidden or 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 -*- | |
""" | |
Performance test for different types of update | |
Results sample | |
----------------------------------------------- | |
In [1]: import db_test |
This file contains hidden or 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
import urllib | |
urls = [ | |
'http://ru.wikipedia.org/wiki/%D0%91%D0%B5%D0%B4%D1%83%D0%B8%D0%BD%D1%8B', | |
'http://ru.wikipedia.org/wiki/%C1%E5%E4%F3%E8%ED%FB', | |
] | |
def urlunquote(url, guess_charsets=None): | |
if guess_charsets is None: | |
guess_charsets = ['utf-8', 'cp1251'] |
This file contains hidden or 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
# pip install watchdog | |
exec watchmedo shell-command --patterns='*.rst;*.py' --ignore-pattern='_build/*' --recursive --command='make html' --wait |
This file contains hidden or 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 -*- | |
# This is how I'd implement this using only bare pytest functionality | |
import pytest | |
from user import add_transaction, delete_transaction, get_user_balance | |
# Attempt 1. | |
# According to the documentation at http://pytest.org/latest/fixture.html | |
# try to start with a simple fixture |
This file contains hidden or 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 -*- | |
# requirements: requests, lxml | |
import requests | |
from lxml import html | |
def get_tree(): | |
resp = requests.get('http://2013.djangocon.eu/vote/') | |
tree = html.fromstring(resp.text) |
This file contains hidden or 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 | |
""" | |
Requirements: | |
android2po | |
opterator | |
Sample: | |
$ python android2po_plurals.py pl |