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
;; Replace hash rockets with Ruby 1.9 symbol keys | |
(defun replace-hash-rockets () | |
(interactive) | |
(goto-char 1) | |
(while (search-forward-regexp ":\\(\\(\\w\\|_\\)+\\) =>" nil t) | |
(replace-match (concat (match-string 1) ":") t nil))) |
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 input "bbbddddaaacccc") | |
(defn- lowest-code-point [coll] | |
(first (into (sorted-map-by #(< (int %1) (int %2))) coll))) | |
(defn- take-while= [value coll] | |
(take-while (fn [[_ v]] (== value v)) coll)) | |
(let [counts (frequencies input) | |
sorted (sorted-map-by |
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 minmax-by-codepoint [s] | |
(let [sorted (reduce (fn [r [c cnt]] | |
(update-in r [cnt] #((fnil conj (sorted-set)) % c))) | |
(sorted-map) | |
(frequencies s)) | |
get-char (juxt (comp first second) first)] | |
[(get-char (first sorted)) | |
(get-char (last sorted))])) |
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 test.core | |
(:require [clojure.core.async :refer [<! >!]] | |
[clojure.core.typed :refer [ann U]] | |
[clojure.core.typed.async :refer [Chan go>]])) | |
(ann test-go [(Chan Integer) -> (U (Chan Integer) nil)]) | |
(defn test-go [in] (go> (<! in))) |
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 cursors.core | |
(:refer-clojure :exclude [swap! reset!])) | |
(defprotocol ICursor | |
(-path [c]) | |
(-state [c])) | |
(defprotocol IToCursor | |
(-to-cursor [c state path])) |
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 tctest.core | |
(:require [clojure.core.typed :as t])) | |
(t/defprotocol AProtocol | |
(some-method [this] :- t/AnyInteger | |
[this arg :- t/Any] :- t/AnyInteger)) | |
(t/ann-datatype AType []) | |
(deftype AType [] | |
AProtocol |
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
g = generator(0) | |
=> [Function] | |
g() | |
=> 0 | |
g() | |
=> 1 | |
g() | |
=> 2 |
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 xf.contiguous | |
(:require [clojure.data.int-map :as i])) | |
(defn partition-contiguous | |
([] | |
(let [buffer (volatile! (i/dense-int-set))] | |
(fn [xf] | |
(fn | |
([] (xf)) | |
([result] |
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
(let [partition (juxt :topic :partition) | |
raise? #(case (:operation %) | |
:fetch false | |
:ack true | |
(throw (ex-info "unknown operation" %))) | |
level :offset | |
operations [{:topic "test" :partition 0 :operation :fetch :offset 0} | |
{:topic "test" :partition 0 :operation :fetch :offset 1} | |
{:topic "test" :partition 0 :operation :ack :offset 1} | |
{:topic "test" :partition 1 :operation :fetch :offset 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
flink.jobmanager.Status.JVM.CPU.Load | |
name = "flink_job_manager_cpu_load" | |
flink.jobmanager.Status.JVM.CPU.Time | |
name = "flink_job_manager_cpu_time" | |
flink.taskmanager.Status.JVM.CPU.Load | |
name = "flink_task_manager_cpu_load" | |
flink.taskmanager.Status.JVM.CPU.Time |