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 string | |
from lxml import etree | |
from lxml.etree import QName | |
from lxml.builder import E | |
from hypothesis import strategies as st | |
NS = "http://relaxng.org/ns/structure/1.0" |
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 functools | |
def force_async(fn): | |
''' | |
turns a sync function to async function using threads | |
''' | |
from concurrent.futures import ThreadPoolExecutor | |
import asyncio | |
pool = ThreadPoolExecutor() |
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
from unittest.mock import Mock | |
import asyncpg | |
import pytest | |
from async_lru import alru_cache | |
@alru_cache | |
async def run(): | |
conn = await asyncpg.connect(user='user', password='pass', database='db', host='127.0.0.1') | |
await conn.close() |
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 bjoern | |
import os, signal | |
from django.core.wsgi import get_wsgi_application | |
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') | |
app = get_wsgi_application() | |
NUM_WORKERS = 8 |
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
# based on https://gist.github.com/blueyed/4fb0a807104551f103e6 | |
# and on https://gist.github.com/TauPan/aec52e398d7288cb5a62895916182a9f (gistspection!) | |
from django.db import connection | |
from django.db.migrations.executor import MigrationExecutor | |
import pytest | |
@pytest.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 python3 | |
import operator | |
import subprocess | |
import sys | |
import pkg_resources | |
try: | |
from pip._internal.commands.list import tabulate | |
except ImportError: |
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
# count commits, sort by author | |
$ git shortlog -s -n | |
# same as above, w/o merge commits | |
$ git shortlog -s -n --no-merges | |
# same as above on all remote branches | |
$ git shortlog -s -n --no-merges --all | |
# counts insertions/deletions/delta locs for all authors in repo |
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 bash | |
[ -d "/tmp/zopetest" ] && rm -rf /tmp/zopetest | |
mkdir /tmp/zopetest | |
touch /tmp/zopetest/__init__.py | |
cat > /tmp/zopetest/interface.py << EOL | |
import zope.interface | |
class IFoo(zope.interface.Interface): | |
"""Foo blah blah""" |
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 bash | |
find /usr/share/nano/ -type f -name "*.nanorc" | sed 's/^/include /g' > $HOME/.nanorc |
NewerOlder