This file contains 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
[core] | |
editor = emacs | |
[user] | |
name = pgjones | |
email = | |
[pull] | |
rebase = true |
This file contains 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 random import choice | |
from string import Formatter | |
from timeit import timeit | |
from werkzeug.routing import Map, Rule | |
from werkzeug.routing.matcher import TableMatcher, TreeMatcher | |
# With thanks to https://github.com/richardolsson/falcon-routing-survey for the paths below | |
PATHS = [ |
This file contains 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
pairs = { | |
")": "(", | |
"}": "{", | |
"]": "[", | |
} | |
class Solution: | |
def isValid(self, s: str) -> bool: | |
stack = [] | |
for c in s: |
This file contains 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
DROP TABLE IF EXISTS todos; | |
CREATE TABLE todos ( | |
id INTEGER PRIMARY KEY AUTOINCREMENT, | |
complete BOOLEAN NOT NULL DEFAULT FALSE, | |
due TIMESTAMPTZ, | |
task TEXT NOT NULL | |
); |
This file contains 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 asyncio | |
import inspect | |
from functools import partial | |
import pytest | |
scope = object() | |
receive = object() | |
send = object() |
This file contains 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
rm -rf dist/ build/ | |
python setup.py sdist | |
python setup.py bdist_wheel | |
twine upload dist/* |
This file contains 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
class RateLimit: | |
def __init__(self, count: int, period: timedelta) -> None: | |
self.count = count | |
self.period = period | |
@property | |
def inverse(self) -> float: | |
return self.period.total_seconds() / self.count | |
This file contains 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 asyncio | |
import aiohttp | |
from quart import Quart | |
app = Quart(__name__) | |
async def fetch(url): | |
async with aiohttp.ClientSession() as session: | |
async with session.get(url) as response: |
This file contains 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
ThreadPool = function(script, size) { | |
this.threads = []; | |
this.tasks = []; | |
for (var ithread = 0; ithread < size; ithread++) { | |
this.threads.push(new lxst.FilterThread(script, this)); | |
} | |
}; | |
ThreadPool.prototype.queueTask = function(task, callback) { | |
const task = {task: task, callback: callback}; |
NewerOlder