Skip to content

Instantly share code, notes, and snippets.

@madjar
madjar / extract.py
Created March 15, 2012 09:27
Automatically extract pseudo-sqlalchemy objects from the github api doc
import requests, re
result = requests.get('https://raw.github.com/github/developer.github.com/master/content/v3/events/types.md')
content = result.content
for event in re.findall('## [^#]*', content):
blocks = event.split('\n\n')
event_name = blocks[0][3:]
if 'Hook name' in blocks[1]:
description = ''
@remram44
remram44 / logstack.py
Created September 13, 2013 20:43
Adds context to your stack traces
import contextlib
import linecache
import logging
import sys
import traceback
try:
import cStringIO as StringIO
except ImportError:
import StringIO
@madjar
madjar / scrapper.py
Last active March 5, 2023 15:02
A example of scrapper using asyncio and aiohttp
import asyncio
import aiohttp
import bs4
import tqdm
@asyncio.coroutine
def get(*args, **kwargs):
response = yield from aiohttp.request('GET', *args, **kwargs)
return (yield from response.read_and_close(decode=True))