Here's an example of how to embed a Gist on GitHub Pages:
{% gist 5555251 %}
All you need to do is copy and paste the Gist's ID from the URL (here 5555251
), and add it to a gist
tag surrounded by {%
and %}
.
import groovyx.gpars.dataflow.DataFlowQueue | |
import groovyx.gpars.dataflow.operator.DataFlowPoisson | |
import static groovyx.gpars.dataflow.DataFlow.operator | |
import java.util.concurrent.atomic.AtomicInteger | |
def upstream = new DataFlowQueue() // empty trays travel back upstream to the producer | |
def downstream = new DataFlowQueue() // trays with products travel to the consumer downstream | |
def prodWiring = [inputs: [upstream], outputs: [downstream], maxForks: 3 ] // maxForks is optional | |
def consWiring = [inputs: [downstream], outputs: [upstream], maxForks: 3 ] // maxForks is optional |
;; Copyright (c) Alan Dipert. All rights reserved. | |
;; The use and distribution terms for this software are covered by the | |
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
;; By using this software in any fashion, you are agreeing to be bound by | |
;; the terms of this license. | |
;; You must not remove this notice, or any other, from this software. | |
(ns alandipert.kahn | |
(:require [clojure.set :refer [difference union intersection]])) |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
Here's an example of how to embed a Gist on GitHub Pages:
{% gist 5555251 %}
All you need to do is copy and paste the Gist's ID from the URL (here 5555251
), and add it to a gist
tag surrounded by {%
and %}
.
import groovy.transform.* | |
////////////////////////////////////// | |
// Testing | |
////////////////////////////////////// | |
new MiniKanren().with { | |
// for a given 'q' and 'r' | |
def (q,r) = [ lvar( 'q' ), lvar( 'r' ) ] | |
(require '[clojure.core.async :refer [chan go >! <! >!! <!!]]) | |
(require '[clojure.core.async :as async]) | |
(defn chan-bridge | |
([ch-source map-f ch-target] | |
"map map-f onto ch-source and copy the result to ch-target" | |
(chan-bridge (async/map map-f [ch-source]) ch-target)) | |
([ch-source ch-target] | |
"in a loop read from ch-source and write to ch-target | |
this function returns inmediately and returns the ch-target" |
(ns clojure-conj-talk.core | |
(:use [enchilada :only [canvas ctx canvas-size]] | |
[monet.canvas :only [fill-style fill-rect]] | |
[jayq.core :only [show]]) | |
(:require [cljs.core.async :refer [<! >! chan timeout]]) | |
(:require-macros [cljs.core.async.macros :as m :refer [go]])) | |
(def colors | |
(rand-nth [ | |
[ |
alias usejava6='export JAVA_HOME=$(/usr/libexec/java_home -v 1.6) ; PATH=$JAVA_HOME/bin:$PATH' | |
alias usejava7='export JAVA_HOME=$(/usr/libexec/java_home -v 1.7) ; PATH=$JAVA_HOME/bin:$PATH' | |
alias usejava8='export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ; PATH=$JAVA_HOME/bin:$PATH' |
@Grab( 'com.typesafe.akka:akka-actor_2.10:2.3.2' ) | |
@Grab( 'com.typesafe:config:1.2.0' ) | |
import groovy.transform.Immutable | |
import akka.actor.ActorRef | |
import akka.actor.ActorSystem | |
import akka.actor.Props | |
import akka.actor.UntypedActor | |
import akka.actor.UntypedActorFactory | |
import akka.routing.RoundRobinRouter | |
import scala.concurrent.duration.Duration |