Skip to content

Instantly share code, notes, and snippets.

import asyncio
import random
async def slow_action():
await asyncio.sleep(random.randrange(1, 5))
async def my_range(n):
i = 0
while i < n:
import asyncio
import random
async def slow_action():
await asyncio.sleep(random.randrange(1, 5))
async def my_range(n):
i = 0
while i < n:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, re
import itertools
from functools import wraps
from pyquery import PyQuery as pq
class scrape:
@lucasvo
lucasvo / .zshrc.sh
Created August 2, 2012 18:09
Automatically activate your python virtualenvironment
function auto_activate {
SEARCHPATH=`pwd`
function activate_env {
# ZSH outputs errors for the ls * command if you don't disable the nomatch output
unsetopt nomatch 2>/dev/null
ls $SEARCHPATH/*/bin/activate > /dev/null 2> /dev/null
if [ "$?" = '0' ]; then
deactivate > /dev/null 2> /dev/null