Skip to content

Instantly share code, notes, and snippets.

View aglyzov's full-sized avatar

Aleksandr Glyzov aglyzov

  • Rostov-on-Don, Russian Federation
View GitHub Profile
@aglyzov
aglyzov / gist:5585806
Last active December 17, 2015 09:18
Illustrating a bug (?) in tornado 3.0.1 when fetching a firewalled https url -- a Timeout exception cannot be caught in the calling coroutine.
#!/usr/bin/env python3.3
from logging import getLogger
from tornado.ioloop import IOLoop
from tornado.options import parse_command_line
from tornado.httpclient import AsyncHTTPClient
from tornado.httputil import HTTPHeaders
from tornado.gen import coroutine
@aglyzov
aglyzov / gist:5643563
Last active December 17, 2015 17:09
A bug in plyvel 0.2 -- reverse iterators with prefix are badly broken
#!/bin/env python3
import plyvel
db = plyvel.DB('/tmp/test-reverse-iterator.db', create_if_missing=True)
db.put(b'aaa', b'1')
db.put(b'bbb', b'2')
# these pass:
@aglyzov
aglyzov / gocryptfs.sh
Created February 18, 2017 18:36
A shell script that mounts a gocrypto volume and then auto-unmounts it when the shell exits
#!/bin/sh
# This script mounts an gocryptfs filesystem, starts a shell in the mounted
# directory, and then unmounts the filesystem when the shell exits.
# This is an equivalent of the cfssh utility for cfs.
# Contributed by David Rosenstrauch.
canonicalize() {
cd "$1"
pwd