Skip to content

Instantly share code, notes, and snippets.

View playpauseandstop's full-sized avatar

Igor Davydenko playpauseandstop

View GitHub Profile
@playpauseandstop
playpauseandstop / posterous-to-blogger.py
Created April 25, 2013 14:14
Import posts from Posterous backup to Blogger account.
#!/usr/bin/env python
#
# Import posts from Posterous backup to Blogger account.
#
# Requirements
# ============
#
# * `Python <http://www.python.org/>` 2.6 or 2.7
# * `GData <http://pypi.python.org/pypi/gdata>`_ 2.0.17 or higher
#
@playpauseandstop
playpauseandstop / bench_django_memcached.py
Created November 1, 2012 14:22
Bench for getting data from Memcached via Django cache
#!/usr/bin/env python
import copy
import sys
import time
from argparse import ArgumentParser
from random import choice
from string import digits, letters
@playpauseandstop
playpauseandstop / ralc.py
Created November 1, 2012 09:46
Rates calculator
#!/usr/bin/env python
#
# Rates calculator.
#
# Requirements
# ============
#
# * `Python <http://www.python.org/>`_ 2.7
#
# Installation
@playpauseandstop
playpauseandstop / CouchBase
Created October 26, 2012 09:30
CouchBase vs. Memcached vs. Redis vs. Redis Pipelined
$ DRIVER=couchbase THREADS=10 make benchmark
env/bin/python ./benchmark.py
324 operations completed in 2.1607 s
2256 operations completed in 10.7558 s
1068 operations completed in 5.7570 s
2037 operations completed in 9.5393 s
2493 operations completed in 11.0871 s
2910 operations completed in 12.1000 s
2961 operations completed in 12.1318 s
2193 operations completed in 10.3703 s
@playpauseandstop
playpauseandstop / app.py
Created October 17, 2012 09:31
Improve registering blueprints in Flask application
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
class App(Flask):
"""
Custom ``Flask`` class.
"""
def register_blueprint(self, mixed, **kwargs):
"""
@playpauseandstop
playpauseandstop / multiprocessing-demo.py
Created July 20, 2012 12:40
Run X processes in background and wait before each of this processes will end.
#!/usr/bin/env python
#
# Run X processes in background and wait before each of this processes will
# end.
#
import sys
import time
from argparse import ArgumentParser
#!/usr/bin/env python
#
# Redirect outputs from pbs command result to file.
#
import os
import pbs
@playpauseandstop
playpauseandstop / output
Created July 13, 2012 08:01
Playing with cloned virtual environments
Checking env_base virtual environment...
ordereddict exists
minimock exists
0.9
Checking env_child virtual environment...
ordereddict exists
minimock exists
0.8
@playpauseandstop
playpauseandstop / archive-repo.sh
Created May 28, 2012 19:08
Simple script to archive git repository
#!/bin/sh
#
# Simple script to archive git repository.
#
branch=HEAD
dest=`echo ~/Projects`
format=zip
prefix=`basename $(pwd)`
@playpauseandstop
playpauseandstop / settings.py
Created May 2, 2012 09:55
Disable Flask's debug logger if testing mode enabled
import logging
import os
DEBUG = False
TESTING = 'TESTING' in os.environ or 'nosetests' in os.environ.get('_', '')
try:
from settings_local import *