I hereby claim:
- I am oinopion on github.
- I am oinopion (https://keybase.io/oinopion) on keybase.
- I have a public key ASBxi5CUEoLSH6wms2YYL3bjYNdlnJeMPewkFUAyGHtttgo
To claim this, I am signing this object:
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Run 'vagrant up' to start server | |
# Apache will be available at localhost:8000 | |
# Nginx will be available at localhost:7000 | |
# Both share htpass and data directory | |
# To upload file via PUT do: | |
# $ curl 'http://vagrant:vagrant@localhost:8000/hello.txt' -T hello.txt | |
# To create collection do: |
grep -iRIL 'unicode_literals' --include '*.py' --exclude '__init__.py' |
def in_batches(sequence, n=2): | |
""" | |
>>> list(in_batches([1, 2, 3, 4, 5], n=2)) | |
[[1, 2], [3, 4], [5, None]] | |
""" | |
iterable = iter(sequence) | |
try: | |
while True: | |
values = [None] * n | |
for i in xrange(n): |
import json | |
import random | |
closeds = json.load(open('closed.json')) | |
opens = json.load(open('open.json')) | |
def today(pr): | |
return pr['created_at'].startswith('2014-02-15') | |
prs = [p for p in (opens+closeds) if today(p)] |
-- Create a group | |
CREATE ROLE readaccess; | |
-- Grant access to existing tables | |
GRANT USAGE ON SCHEMA public TO readaccess; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
-- Grant access to future tables | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
# Read docs here: https://docs.python.org/3/library/contextlib.html | |
>>> from contextlib import contextmanager | |
>>> | |
>>> | |
>>> @contextmanager | |
... def deco_and_cm(): | |
... print('Hello') | |
... yield | |
... print('Goodbye') | |
... |
I hereby claim:
To claim this, I am signing this object: