Skip to content

Instantly share code, notes, and snippets.

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)
#! bin/buildout -c
[buildout]
extends = buildout.cfg
develop +=
../fscrawler
[versions]
fscrawler=
#! /usr/bin/env python
import smtplib
_from = "[email protected]"
_to = "[email protected]"
s = smtplib.SMTP("brainbot.com", 25)
s.set_debuglevel(True)
s.ehlo()
# save this as ~/.config/pep8
[pep8]
ignore = E401,E501,E126,E123,E128,E127,E124,E122
exclude = .svn,CVS,.bzr,.hg,.git,.tox,build
# use ssh url instead of anonymous
[url "[email protected]:brainbot-com/"]
insteadOf = https://github.com/brainbot-com/
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__
(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)
(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 "$")
(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
(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