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:
I hereby claim:
To claim this, I am signing this object:
# 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') | |
... |
-- 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; |
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)] |
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): |
grep -iRIL 'unicode_literals' --include '*.py' --exclude '__init__.py' |
# -*- 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: |
TASK: [aasdfasds] ********************* | |
ok: [192.168.60.2] => {"msg": "$home/13-02-17--19-36-28"} | |
TASK: [pause seconds=2] ********************* | |
(^C-c = continue early, ^C-a = abort) | |
[192.168.60.2] | |
Pausing for 2 seconds | |
ok: [192.168.60.2] => {"changed": false, "delta": 2, "rc": 0, "start": "2013-02-17 19:36:28.635563", "stderr": "", "stdout": "Paused for 2.0 seconds", "stop": "2013-02-17 19:36:30.635935"} | |
TASK: [aasdfasd] ********************* |
TASK: [debug msg="/home/$user/13-02-17--15-23-58"] ********************* | |
ok: [192.168.60.2] | |
TASK: [pause seconds=5] ********************* | |
(^C-c = continue early, ^C-a = abort) | |
[192.168.60.2] | |
Pausing for 5 seconds | |
ok: [192.168.60.2] | |
TASK: [debug msg="/home/$user/13-02-17--15-24-04"] ********************* |
package gchat | |
import "log" | |
import "net" | |
import "bufio" | |
import "fmt" | |
func Serve() { | |
fmt.Println("Start server on port 2000") | |
l, err := net.Listen("tcp", ":2000") |