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
ERROR:root:STDOUT: File "/mnt/workspace/lunr/lunr/db/uuidimpl.py", line 62, in process_result_value | |
ERROR:root:STDOUT: return str(uuid.UUID(value)) | |
ERROR:root:STDOUT: File "/usr/lib/python2.6/uuid.py", line 134, in __init__ | |
ERROR:root:STDOUT: raise ValueError('badly formed hexadecimal UUID string') | |
ERROR:root:STDOUT: ValueError: badly formed hexadecimal UUID string |
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
$ cat test.py | |
from cStringIO import StringIO | |
expected = 'a' | |
result = StringIO('a').read() | |
assert result is expected | |
expected = 'abc' | |
result = StringIO('abc').read() | |
assert result is expected, "%s is not %s" % (repr(result), repr(expected)) | |
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 os | |
from ctypes import CDLL, get_errno, c_char_p, c_int | |
libc = CDLL(None, use_errno=True) | |
def errcheck(result, func, arguments): | |
if result != 0: | |
e = get_errno() | |
raise OSError(e, os.strerror(e)) |
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 ResourceExceptionHandler(object): | |
"""Context manager to handle Resource exceptions. | |
Used when processing exceptions generated by API implementation | |
methods (or their extensions). Converts most exceptions to Fault | |
exceptions, with the appropriate logging. | |
""" | |
def __enter__(self): | |
return None |
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 os | |
import mmap | |
from contextlib import contextmanager | |
BLOCK_SIZE = 4 * 1024 | |
@contextmanager | |
def dopen(filename, blockno=1): | |
try: | |
fd = os.open(filename, os.O_CREAT | os.O_DIRECT | os.O_RDWR) |
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 ctypes | |
from ctypes import cdll, util | |
import os | |
libc = cdll.LoadLibrary(util.find_library('c')) | |
_get_errno_loc = libc.__errno_location | |
_get_errno_loc.restype = ctypes.POINTER(ctypes.c_int) | |
def get_errno(): | |
return _get_errno_loc().contents.value |
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
COMMANDS = {} | |
def command(f): | |
COMMANDS[f.__name__] = f | |
return f | |
@command | |
def func1(): | |
print 'func1' |
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
(pep8)clayg@clayg-laptop:~/devenv/sandbox/pep8$ cat test.py | |
class A(object): | |
def __init__(self, | |
blah, | |
monkies): | |
self.blah = blah | |
a = A('monkies', | |
'yay') |
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
(pep8)clayg@clayg-laptop:~/devenv/sandbox/pep8$ cat test.py | |
# passes | |
foo = long_function_name(var_one, var_two, | |
var_three, var_four) | |
# passes | |
def long_function_name( | |
var_one, var_two, | |
var_three, var_four): |
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
#!/bin/bash | |
set -v | |
aptitude update &> /dev/null | |
DEBIAN_FRONTEND=noninteractive aptitude install mdadm -y | |
mdadm --create /dev/md0 --chunk=4096 --level=0 --raid-devices=5 /dev/xvd[e-i] | |
time dd if=/dev/md0 of=/dev/null iflag=direct bs=4096 count=10240 | |
time dd if=/dev/md0 of=/dev/null iflag=direct bs=65536 count=640 | |
time dd if=/dev/zero of=/dev/md0 oflag=direct bs=4096 count=10240 | |
time dd if=/dev/zero of=/dev/md0 oflag=direct bs=65536 count=640 | |
while !$(mdadm --stop /dev/md0); do |