Skip to content

Instantly share code, notes, and snippets.

View alekseyev's full-sized avatar

Oleksii Aleksieiev alekseyev

View GitHub Profile
alekseyev /
Last active December 21, 2015 05:28
Concurrency in Python 3
# Source:
from concurrent.futures import ThreadPoolExecutor
import random
import time
def sleep_until_the_future(**kwargs):
kwargs['launchtime'] = time.time()
return kwargs
alekseyev /
Last active December 24, 2015 04:38
Simple Mongo ODM
from somewhere import get_mongo_db
# assuming get_mongo_db returns db instance
class MongoException(Exception):
class MongoField(object):
alekseyev /
Created October 3, 2013 14:23
Fabric script to transfer DB dump from remote server
import os
import json
import time
from fabric.api import local, run, cd, env, task
from fabric.operations import get
from fabric.context_managers import cd, prefix
from settings import DATABASES, MEDIA_ROOT
<!DOCTYPE html>
<link rel="stylesheet" href="" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<div class="container">