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 pytest, py, os | |
@pytest.fixture(autouse=True) | |
def chdir_tmpdir(request, tmpdir): | |
"""autouse fixture that chdirs to tmpdir""" | |
cwd = py.path.local(".") | |
tmpdir.chdir() | |
request.addfinalizer(cwd.chdir) |
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/buildout -c | |
[buildout] | |
extends = buildout.cfg | |
develop += | |
../fscrawler | |
[versions] | |
fscrawler= |
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
#! /usr/bin/env python | |
import smtplib | |
_from = "[email protected]" | |
_to = "[email protected]" | |
s = smtplib.SMTP("brainbot.com", 25) | |
s.set_debuglevel(True) | |
s.ehlo() |
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
# save this as ~/.config/pep8 | |
[pep8] | |
ignore = E401,E501,E126,E123,E128,E127,E124,E122 | |
exclude = .svn,CVS,.bzr,.hg,.git,.tox,build |
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
# use ssh url instead of anonymous | |
[url "[email protected]:brainbot-com/"] | |
insteadOf = https://github.com/brainbot-com/ |
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
In [23]: from pyethereum import trie | |
In [24]: t=trie.Trie("foo2") | |
In [25]: t.__dict__ | |
Out[25]: {'db': <pyethereum.trie.DB at 0x128a950>, 'debug': False, 'root': ''} | |
In [26]: t.update("foo", "bar") | |
In [27]: t.__dict__ |
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
(ns sandbox.core) | |
(defprotocol GetUserData | |
"get user data" | |
(getUserData [this] "get user data")) | |
(def d (proxy [Object sandbox.core.GetUserData] [] | |
(getUserData [] 42))) | |
;; sandbox.core=> (getUserData d) |
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
(in-ns 'clojure.core) | |
;; make reloading namespaces work with proxy! | |
(defn proxy-name** | |
{:tag String} | |
[^Class super interfaces] | |
(let [inames (into1 (sorted-set) (map #(.getName ^Class %) interfaces)) | |
ihashes (into1 (sorted-set) (map #(System/identityHashCode %) interfaces))] | |
(apply str (.replace (str *ns*) \- \_) ".proxy" | |
(interleave (repeat "$") |
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
(defn code-points-from-string | |
[^String s] | |
(iterator-seq (.iterator (.codePoints s)))) | |
(defn string-from-code-points | |
[s] | |
(let [ia (int-array s)] | |
(String. ia 0 (count s)))) | |
(defn decode |
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
(defn code-points-from-string | |
[^String s] | |
(iterator-seq (.iterator (.codePoints s)))) | |
(defn string-from-code-points | |
[s] | |
(let [ia (int-array s)] | |
(String. ia 0 (count s)))) | |
(defn decode-with-fn |