Skip to content

Instantly share code, notes, and snippets.

View AlBaker's full-sized avatar

Al Baker AlBaker

View GitHub Profile
@staltz
staltz / introrx.md
Last active June 28, 2025 13:44
The introduction to Reactive Programming you've been missing
@candera
candera / ssh-repl.org
Last active February 9, 2019 07:50
ssh-repl

Embedding an SSH-accessible REPL in a Clojure process

N.B. This is now a library, thanks to the efforts of the wonderful @mtnygard. And the README does a good job of making clear just how terrible an idea it is to actually do this. :)

As any Clojurist knows, the REPL is an incredibly handy development tool. It can also be useful as a tool for debugging running programs. Of course, this raises the question of how to limit access to the REPL to authorized parties. With the Apache SSHD library, you can embed an SSH server in any JVM process. It takes only a little code to hook this up to a REPL, and to limit access either by public key or

@timyates
timyates / pisystem.groovy
Last active July 23, 2018 13:27
Pi Approximation With Akka and Groovy
@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
@schwarzmx
schwarzmx / .bash_profile
Created April 7, 2014 14:32
multiple JDKs - Mac OS X
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'
@rm-hull
rm-hull / blocks.cljs
Last active April 2, 2025 14:46
Core.async example from Timothy Baldridge's Clojure/Conj 2013 talk: http://youtu.be/enwIIGzhahw, demonstrating 4800 'green' threads. Code modified from: https://github.com/halgari/clojure-conj-2013-core.async-examples/blob/master/src/clojure_conj_talk/core.clj#L585
(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 [
[
@gerritjvv
gerritjvv / clojure async channel bridge
Created December 31, 2013 16:58
Simple thing to do, but requires repeated typing. The only thing it does is move from channel-a to channel-b. This function is implemented in https://github.com/gerritjvv/fun-utils
(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"
@debasishg
debasishg / gist:8172796
Last active June 23, 2025 05:56
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&amp;rep=rep1&amp;t
@timyates
timyates / logic.groovy
Last active December 23, 2015 12:59
A miniKanren in Groovy blatantly copied from https://github.com/funjs/friebyrd
import groovy.transform.*
//////////////////////////////////////
// Testing
//////////////////////////////////////
new MiniKanren().with {
// for a given 'q' and 'r'
def (q,r) = [ lvar( 'q' ), lvar( 'r' ) ]
@benbalter
benbalter / gist.md
Last active May 24, 2025 09:51
Example of how to embed a Gist on GitHub Pages using Jekyll.

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 %}.

@jboner
jboner / latency.txt
Last active July 2, 2025 06:46
Latency Numbers Every Programmer Should Know
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