This file contains hidden or 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
# When Tab is pressed on an empty(!) command line, the contents of the | |
# directory are printed (`ls`) instead of a menu list of all | |
# executables: | |
function my-hg-report() { | |
tip=$(hg tip 2> /dev/null) || return | |
echo | |
hg --config pager.pager= status | |
echo | |
hg --config pager.pager= log --limit 5 --style compact |
This file contains hidden or 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 soka-trb.jdbc-streaming | |
"streaming results in clojure.java.jdbc, when {:use-streaming? true} is passed | |
as option | |
hooks into jdbc/prepare-statements and calls turn-on-streaming | |
Users need to extend the TurnOnStreaming protocol for their databases | |
" | |
(:require [clojure.java.jdbc :as jdbc] | |
[robert.hooke])) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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__ |
NewerOlder