- Line by line
- No colors
- Able to be piped into vim (shown later on)
diff <(curl -vs https://reddit.com 2>&1) <(curl -vs https://reddit.com 2>&1)
#!/usr/bin/env boot | |
;; or `BOOT_FILE=ec2query.boot boot repl' for interactive use | |
(set-env! :dependencies '[[amazonica "0.3.23"] | |
[com.datomic/datomic-free "0.9.5344"]]) | |
(require '[amazonica.aws.ec2 :as ec2] | |
'[amazonica.core :refer [defcredential]] | |
'[boot.cli :refer [defclifn]] | |
'[boot.util :refer [info]] |
(require '[datomic.api :as d]) | |
(defn entity-changes | |
"Return transaction history for an entity and its components. | |
Returns a sequence of maps, each is the transaction map (tx metadata) plus a | |
key `:entity-changes`, which is a nested map of keys: entity id, attribute | |
ident, `:db/add` or `:db/retract`, and the value added or retracted, e.g.: | |
{12345678910 {:long-card-1-attr {:db/retract 1 | |
:db/add 0} | |
:long-card-many-attr {:db/add #{0}} |
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.
How to use:
;; clojure.spec's missing piece, work in progress | |
;; this is only halfway done, somebody else will need to do the other 95% | |
(require | |
'[clojure.spec :as s] | |
'[clojure.spec.test :as test]) | |
(defn naive-english-explain | |
"Copy and paste this into your app. Figure out what it does by | |
trying it in production." |
@-moz-document domain("github.com"), domain("gist.github.com") { | |
tt, code, pre, .file-data pre, textarea, .blob-line-code, .blob-code, .blob-code-inner, .diff-line-code { | |
font-family: "Iosevka Fixed SS08", "Iosevka Fixed", "Iosevka Term", "Iosevka", "Input Mono Condensed", "PragmataPro", "Ubuntu Mono", "Menlo"; | |
font-weight: 400; | |
} | |
} | |
@-moz-document domain("gitlab.com") { | |
tt, code, pre, textarea, .code, .file-content.code pre code { | |
font-family: "Iosevka Fixed SS08", "Iosevka Fixed", "Iosevka Term", "Iosevka", "Input Mono Condensed", "PragmataPro", "Ubuntu Mono", "Menlo"; |
(set-env! | |
:target-path "target" | |
:source-paths #{"src"} | |
:dependencies '[[org.clojure/clojure "1.9.0-RC1"] | |
[org.clojure/clojurescript "1.9.946"] | |
[figwheel-sidecar "0.5.14"]]) | |
(require '[figwheel-sidecar.repl-api :as ra]) | |
(deftask cljs-repl [] |
The response to my first few posts has been much larger than I’d imagined and I’d like to thank everyone for the encouragement.
If you’re interested in building a trading system I recommend first reading my previous post on general ideas to keep in mind.
My first really technical post will be on how to build a limit order book, probably the single most important component of a trading system. Because the data structure chosen to represent the limit order book will be the primary source of market information for trading models, it is important to make it both absolutely correct and extremely fast.
To give some idea of the data volumes, the Nasdaq TotalView ITCH feed, which is every event in every instrument traded on the Nasdaq, can have data rates of 20+ gigabytes/day with spikes of 3 megabytes/second or more. The individual messages average about 20 bytes each so this means handling
#!/bin/sh | |
#_( | |
true; exec clj -J-Xmx256M -J-XX:-OmitStackTraceInFastThrow -Sdeps "`sed -n -e '/;;(DEPS$/,/;;DEPS)$/p' $0`" -M -i $0 -e '(user/main)' | |
) | |
(ns user | |
#?(:cljs (:require-macros [user :as m])) | |
(:require | |
#?@(:clj ([cljs.build.api :as cljs] |
(ns datomic-traverser | |
(:require [clojure.set :as set] | |
[datomic.api :as d] | |
[loom.graph :as graph] | |
[loom.alg :as alg])) | |
;; An implementation of Loom graph backed by a Datomic db, where nodes are | |
;; Datomic entities and edges are determined by datoms of attribute type ref, | |
;; filtered with forward-attr-blacklist and backward-attr-whitelist. | |
;; node-subset, when present, will restrict the nodes and edges to those |