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
| env)10:45:46 Clojure (master) > git clone [email protected]:eigenhombre/matrix-api.git | |
| Cloning into 'matrix-api'... | |
| remote: Counting objects: 4605, done. | |
| remote: Compressing objects: 100% (1654/1654), done. | |
| remote: Total 4605 (delta 1784), reused 4570 (delta 1751) | |
| Receiving objects: 100% (4605/4605), 389.91 KiB | 387 KiB/s, done. | |
| Resolving deltas: 100% (1784/1784), done. | |
| (env)10:46:25 Clojure (master) > cd matrix-api/ | |
| (env)10:46:31 matrix-api (master) > lein test | |
| Retrieving com/google/caliper/caliper/0.5-rc1/caliper-0.5-rc1.pom from central |
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
| Andreas's problem: | |
| hi. trying to get i3live running on ubuntu 12.04 and while doing 'python manage.py migrate' I get: | |
| > livedata:0008_allow_null_fields_for_veri | |
| ! Error found during real run of migration! Aborting. | |
| ! Since you have a database that does not support running | |
| ! schema-altering statements in transactions, we have had | |
| ! to leave it in an interim state between migrations. | |
| ! You *might* be able to recover with: | |
| ! The South developers regret this has happened, and would |
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
| pdaq@ichub21[~] 17:11:26 (0)$ cat /proc/driver/domhub/card?/pair?/is-plugged | |
| Card 0 Pair 0 is plugged in. | |
| Card 0 Pair 1 is plugged in. | |
| Card 0 Pair 2 is not plugged in. | |
| Card 0 Pair 3 is not plugged in. | |
| Card 1 Pair 0 is plugged in. | |
| Card 1 Pair 1 is plugged in. | |
| Card 1 Pair 2 is not plugged in. | |
| Card 1 Pair 3 is not plugged in. | |
| pdaq@ichub21[~] 17:11:43 (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
| class Boiler(object): | |
| """ Boilerplate for standard Python class | |
| >>> class Account(Boiler): | |
| ... __slots__ = ['first', 'last', 'id', 'balance'] | |
| ... | |
| ... def name(self): | |
| ... return "%s %s" (self.first, self.last) | |
| >>> guido = Account('Guido', 'van Rossum', 0, 1000.) | |
| """ |
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 trycore.core | |
| (:require [clojure.core.logic :as l] | |
| [clojure.core.logic.fd :as fd])) | |
| (l/run* [q] | |
| (l/fresh [x y] | |
| (fd/in x y q (fd/interval 1 1000)) | |
| (fd/eq (= (* x 33) q)) | |
| (fd/eq (= (* y 8) q)))) |
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
| (->> human | |
| sequence-headers | |
| (map (juxt :name :dna-size :n-block-count)) | |
| clojure.pprint/pprint) | |
| ;; Gives: | |
| (["chr1" 249250621 39] | |
| ["chr2" 243199373 24] |
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
| (->> human | |
| sequence-headers | |
| first | |
| ((juxt :n-block-starts :n-block-sizes)) | |
| (apply interleave) | |
| (partition 2) | |
| (map vec) | |
| clojure.pprint/pprint) |
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
| import contextlib | |
| @contextlib.contextmanager | |
| def foo(): | |
| print "I'm a foo!" | |
| yield | |
| with contextlib.nested(*[foo() for _ in range(200)]): | |
| pass |
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 test_create_lots_of_threads_and_each_send_a_message(): | |
| N = 40 | |
| with queueing_receiver() as (q, t): | |
| with contextlib.nested(*[sender() for _ in range(N)]) as senders: | |
| for i, s in enumerate(senders): | |
| s.send(str(i)) | |
| t.wakeup() | |
| eq(len([q.get(timeout=1) for _ in range(N)]), N) |
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
| import contextlib | |
| import threading | |
| @contextlib.contextmanager | |
| def pcontext(): | |
| print "in context" | |
| yield 66 | |