Skip to content

Instantly share code, notes, and snippets.

@iffy
iffy / bar_foo.js
Last active August 29, 2015 13:56
jshint behaves differently for absolute paths and relative paths as far as ignoring goes
syntax error
@iffy
iffy / expected_output
Created April 26, 2014 03:58
How do I get inspect.getsource to get the right source?
class A(object):
def foo(self):
pass
class A(object):
def bar(self, a, b, c):
pass
@iffy
iffy / output
Created September 22, 2014 16:31
How do I patch a classmethod?
python -m unittest patch_classmethod
E
======================================================================
ERROR: test_usesCreate (patch_classmethod.someFuncTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "patch_classmethod.py", line 27, in test_usesCreate
someFunc('hey')
File "patch_classmethod.py", line 11, in someFunc
return Foo.create(arg)
@iffy
iffy / pooling.py
Created December 2, 2014 19:22
An idea for pooling in Alchimia
from twisted.internet import defer
from collections import deque
class TimeoutError(Exception):
pass
class Pooler(object):
# Create the cluster token
docker-machine create -d virtualbox first-machine
$(docker-machine env first-machine)
export TOKEN=$(docker run swarm create)
# Create a master
MASTER_NAME="swarm-master"
docker-machine create -d virtualbox --swarm --swarm-master --swarm-discovery token://${TOKEN} ${MASTER_NAME}
# Create some nodes
FROM ubuntu
RUN apt-get update -y
RUN apt-get install -y python-dev
RUN apt-get install -y libmysqlclient-dev
RUN apt-get install -y python-pip && pip install -U pip
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
package main
import (
"os"
"os/exec"
"fmt"
"flag"
"log"
"net"
"net/rpc"
@iffy
iffy / output
Created August 10, 2015 22:43
Question: How can I get at the `ApplicationSession` instance created through `ApplicationRunner` without polling the private `_session` attribute of the protocol?
$ trial ~/Desktop/sample.py
sample
MyTest
test_stuff ... polling :(
[OK]
-------------------------------------------------------------------------------
Ran 1 tests in 0.169s
PASSED (successes=1)
@iffy
iffy / install log
Created March 2, 2011 19:03
trying to install python with curses
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking asm/types.h usability... no
checking asm/types.h presence... no
checking for asm/types.h... no
checking conio.h usability... no
checking conio.h presence... no
checking for conio.h... no
@iffy
iffy / File 2
Created June 14, 2011 17:12 — forked from hagna/File 2
The description
This is the second file.
And this is more content.