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
(defn histogram-with-normal-distribution [ds] | |
"Produce a histgoram of the single-dimensional dataset ds and the corresponding normal distribution." | |
(with-data ds | |
(let [x-mean (mean ds) | |
x-sd (sd ds) | |
x-min (apply min ds) | |
x-max (apply max ds) | |
h (doto (histogram ds :nbins 100 :density true) | |
(set-stroke-color java.awt.Color/blue) | |
(set-title "Distribution of latencies") |
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
(defn regression-nclients-ms [ds] | |
(with-data ds | |
(let [x ($ :nclients) | |
y ($ :ms) | |
lm (linear-model y x)] | |
(doto (scatter-plot x y :x-label "Number of clients." :y-label "Latency (ms)") | |
(add-lines x (:fitted lm)) | |
(set-title "Regression: linear model of number of clients to latency") | |
view)))) |
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
(defmacro with-timeout [ms & body] | |
`(let [f# (future ~@body)] | |
(.get #^java.util.concurrent.Future f# ~ms | |
java.util.concurrent.TimeUnit/MILLISECONDS))) |
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
using System; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Text; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace Test.Playground | |
{ | |
[TestClass] | |
public class KaazingPublishTest |
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 kaazing-eval.core | |
(import [java.io File] | |
[java.net DatagramPacket DatagramSocket InetSocketAddress URI])) | |
(defn publish [msg] | |
(let [remote-uri (URI/create "udp://localhost:50505") | |
remote-addr (InetSocketAddress. (.getHost remote-uri) | |
(.getPort remote-uri)) | |
socket (DatagramSocket.)] | |
(let [bytes (.getBytes msg) |
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
(wc -l (grep "foo" (cat "foo.txt"))) | |
(->> (cat "foo.txt") (grep "foo") "wc -l") |
NewerOlder