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 '[spec-tools.core :as st]) | |
(require '[spec-tools.spec :as st.s]) | |
(require '[clojure.spec.alpha :as s]) | |
(s/def ::cheese st.s/string?) | |
(s/def ::stuff st.s/int?) | |
(s/def ::bar (st/spec (s/keys :req-un [::cheese]))) | |
(s/def ::foo (st/spec (s/keys :req-un [::stuff]))) | |
(s/def ::response (s/or :b ::bar :f ::foo)) |
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
brew 'ack' | |
brew 'ag' | |
brew 'coreutils' | |
brew 'bash-completion' | |
brew 'openssl' | |
brew 'readline' | |
brew 'ispell' | |
brew 'wget' | |
brew 'tree' | |
brew 'autoenv' |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 '[clojure.core.async :as async :refer :all]) | |
(defmacro sleep | |
([ms stop-channel] | |
`(alts! [(timeout ~ms) ~stop-channel])) | |
([ms] | |
`(<! (timeout ~ms)))) | |
(defmacro go-loop [bindings & body] | |
(let [stop (first bindings)] |
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 simple-sim | |
(require [clojure.core.async :as async] | |
[clojure.tools.logging :as log] | |
criterium.core | |
[com.benmabey.clj-sim :as sim])) | |
;; Andreas' code | |
(defn event [env type val] | |
(let [rc (async/chan)] |
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 rbl.utils.async | |
(:require [clojure.core.async :refer :all] | |
[clojure.tools.macro :refer [macrolet]])) | |
(defn batch-until-pause | |
"Batches values from the `in` channel into a single a vec of values up until no | |
messages have appeared in `timeout-pause` milliseconds. `max-batch-time` is the | |
number of milliseconds to wait overall before sending a batch." | |
([timeout-pause max-batch-time in] | |
(batch-until-pause timeout-pause max-batch-time in (chan))) |
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 schema-helpers | |
(:require [schema.core :as s])) | |
(defn tuple | |
"Returns a schema for a sequence containing exactly the schema/name pairs. | |
To denote an optional element use {schema name} instead of [schema name]. | |
Example: | |
(def t (tuple [String 'foo] [s/Keyword 'bar] {Number 'num})) |
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 rbl.utils.async | |
(:require [clojure.core.async :refer :all])) | |
(defmacro sleep | |
([ms & stop-channels] | |
(let [to (list 'timeout ms)] | |
`(alts! ~(into [to] stop-channels)))) | |
([ms] | |
`(<! (timeout ~ms)))) |
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
from IPython.core.magic import (Magics, magics_class, line_magic, | |
cell_magic, line_cell_magic) | |
import pyodbc | |
import pandas.io.sql as sql | |
@magics_class | |
class SQLMagic(Magics): | |
con = None |
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 rbl.feature-extraction.user-agent | |
(:use [clojure.core.memoize :only [memo]]) | |
(:require [clojure.tools.logging :as log]) | |
(:import [nl.bitwalker.useragentutils UserAgent DeviceType Browser OperatingSystem])) | |
(defn str->features [string] | |
(try | |
(let [user-agent (UserAgent. (or string ""))] | |
{:browser_group (-> user-agent .getBrowser .getGroup .getName) | |
:os_group (-> user-agent .getOperatingSystem .getGroup .getName) |