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 |
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
(require '[boot.pod :as pod] | |
'[boot.tmpdir :as tmpdir] | |
'[clojure.java.io :as io] | |
'[clojure.string :as string]) | |
(task-options! | |
pom {:project 'steinmetz | |
:version "0.1.0"} | |
repl {:init-ns 'user} | |
aot {:namespace #{}} |
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
def find_ip (): | |
# we get a UDP-socket for the TEST-networks reserved by IANA. | |
# It is highly unlikely, that there is special routing used | |
# for these networks, hence the socket later should give us | |
# the ip address of the default route. | |
# We're doing multiple tests, to guard against the computer being | |
# part of a test installation. | |
candidates = [] | |
for test_ip in ["192.0.2.0", "198.51.100.0", "203.0.113.0"]: |
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
(deftask dev-repl | |
"start development repl" | |
[] | |
(comp (dev-profile) (repl))) |
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
;;; cwc.el --- whitespace-cleanup only for changed lines | |
;; | |
;; Author: Ralf Schmitt <ralf@systemexit.de> | |
;; Version: 0.1 | |
;; Last Changed: 2010-04-13 17:03:32 by ralf | |
;;; Commentary: | |
;; | |
;; run whitespace-cleanup only on changed lines in a buffer. needs | |
;; highlight-changes mode to do it's work. |
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
# Last-changed: 2010-07-29 00:39:14 by ralf | |
""" | |
this module installs a custom __import__ function, which switches | |
sys.modules on a per-thread basis. patch_all must be called from the | |
gevent thread. the threads will only import unpatched modules. | |
""" | |
import imp, sys, threading |
OlderNewer