Skip to content

Instantly share code, notes, and snippets.

View mithrandi's full-sized avatar

Tristan Seligmann mithrandi

View GitHub Profile
@mithrandi
mithrandi / init.el
Created February 9, 2016 07:10
Twistedchecker for flycheck (Emacs)
;; Define the checker
(flycheck-define-checker python-twistedchecker
"A Python syntax and style checker using twistedchecker."
:command ("twistedchecker"
;; Need `source-inplace' for relative imports (e.g. `from .foo
;; import bar'), see https://github.com/flycheck/flycheck/issues/280
source-inplace)
:error-filter
(lambda (errors)
(flycheck-sanitize-errors (flycheck-increment-error-columns errors)))
==2124==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4676669 at pc 0x085c7b84 bp 0xffbfa928 sp 0xffbfa920
WRITE of size 4 at 0xf4676669 thread T0
#0 0x85c7b83 in cell_dealloc /tmp/Python-3.5.1/Objects/cellobject.c:49
#1 0x85e971d in frame_dealloc /tmp/Python-3.5.1/Objects/frameobject.c:433
#2 0x83b8341 in _PyEval_EvalCodeWithName /tmp/Python-3.5.1/Python/ceval.c:3977
#3 0x838d60d in PyEval_EvalCodeEx /tmp/Python-3.5.1/Python/ceval.c:3987
#4 0x85f19f6 in function_call /tmp/Python-3.5.1/Objects/funcobject.c:632
#5 0x819c887 in PyObject_Call /tmp/Python-3.5.1/Objects/abstract.c:2165
#6 0x839d917 in ext_do_call /tmp/Python-3.5.1/Python/ceval.c:4983
#7 0x83b842a in _PyEval_EvalCodeWithName /tmp/Python-3.5.1/Python/ceval.c:3966
tests/hazmat/backends/test_openssl.py .
========================================================================================================== 1 passed in 0.19 seconds ==========================================================================================================
Program received signal SIGSEGV, Segmentation fault.
0x080dd9db in visit_decref () at ../Modules/gcmodule.c:360
360 in ../Modules/gcmodule.c
(gdb) bt
#0 0x080dd9db in visit_decref () at ../Modules/gcmodule.c:360
#1 0x080ddb2d in dict_traverse () at ../Objects/dictobject.c:2114
tests/hazmat/backends/test_openssl.py
Program received signal SIGSEGV, Segmentation fault.
PyErr_SetObject () at ../Python/errors.c:104
104 ../Python/errors.c: No such file or directory.
(gdb) bt
#0 PyErr_SetObject () at ../Python/errors.c:104 [0/9182]
#1 0x0817da0b in PyErr_FormatV (vargs=0xffffbc88 "9\372\065\b\305D\030\b|GC\b\250\274\377\377p'\227\367\305\267\035\bp'\227\367", format=0x8364644 "an integer is required (got type %.200s)", exception=<type at remote 0x8478b20>)
at ../Python/errors.c:784
#2 PyErr_Format () at ../Python/errors.c:799
#3 0x081db616 in _PyLong_FromNbInt () at ../Objects/longobject.c:145
tests/hazmat/backends/test_openssl.py ...............ss..............s..........ss.ss.ss....
Program received signal SIGSEGV, Segmentation fault.
_PyObject_Malloc.lto_priv.1306 () at ../Objects/obmalloc.c:1159
1159 ../Objects/obmalloc.c: No such file or directory.
(gdb) bt
#0 _PyObject_Malloc.lto_priv.1306 () at ../Objects/obmalloc.c:1159
#1 0x0815e69a in PyObject_Malloc (size=<optimized out>) at ../Objects/obmalloc.c:351
#2 _PyObject_GC_Malloc (basicsize=<optimized out>) at ../Modules/gcmodule.c:1725
#3 _PyObject_GC_New () at ../Modules/gcmodule.c:1748
#4 0x081ef612 in PyCell_New (obj=0x0) at ../Objects/cellobject.c:10
@mithrandi
mithrandi / test.py
Created October 7, 2015 19:49
trial / threadpool interaction
from twisted.internet import reactor
from twisted.internet.defer import gatherResults
from twisted.internet.threads import deferToThread
from twisted.trial.unittest import TestCase
from time import sleep
class Case(TestCase):
def test_threads(self):
return start()
@mithrandi
mithrandi / resource.py
Last active September 22, 2015 19:29
txspinneret route('') issue
from txspinneret.interfaces import ISpinneretResource
from txspinneret.route import Router, routedResource
from zope.interface import implementer
@routedResource
@implementer(ISpinneretResource)
class Root(object):
router = Router()
@mithrandi
mithrandi / gist:3e16ea08bea3ab221137
Created May 14, 2015 10:17
Halcyon-on-Heroku dockerfile
FROM heroku/cedar:14
MAINTAINER Tristan Seligmann <mithrandi@mithrandi.net>
ENV HALCYON_NO_SELF_UPDATE=1
RUN ["git", "clone", "-b", "v1.0.5", "https://github.com/mietek/halcyon.git", "/halcyon"]
RUN ["/halcyon/halcyon", "paths"]
@mithrandi
mithrandi / ax.fish
Last active August 29, 2015 14:18
Fish function for development with axiomatic
function ax
if not set -q PROJECT
set PROJECT (basename $VIRTUAL_ENV)
end
set -l SOURCEDIR {$HOME}/code/{$PROJECT}
if test -z "$PROJECT" -o ! -d "$SOURCEDIR"
echo "Unable to locate project; do you have a virtualenv activated?"
return 1
end
set -l BRANCH (hg --repository $SOURCEDIR branch)
@mithrandi
mithrandi / gist:fdeeb25cb05c846eceab
Last active August 29, 2015 14:18
Version of map handling deferreds/errors
(ns clj-amp.core
(:require [manifold.deferred :as d]
[manifold.stream :as s]))
(defn- map'
"Like manifold.stream/map, except handles deferreds and closes the stream if an error occurs."
([f s]
(let [s' (s/stream)]
(s/connect-via
s
(fn [msg]