Skip to content

Instantly share code, notes, and snippets.

@tomfaulhaber
tomfaulhaber / unzip-excel.sh
Created March 21, 2016 23:48
A shell script that takes an Excel file and a directory and expands the Excel file into that directory as separate files, nicely formatting all the XML files so that they are actually readable.
#!/bin/bash
# Process command line arguments
REPS=10
PREFIX=bench
SCRIPT=
function show_help() {
cat <<EOF 1>&2
@marick
marick / specter.md
Last active August 29, 2015 22:20
A Specter Showcase

Finding all values of :b in the maps inside a vector inside a map inside a vector:

     user=> (def x [{:a [{:b 1} {:b 2} {:a -30}]}
                         {}
                         {:a [{:b 3}]}])
     user=> (select [ALL :a ALL :b] x)
     [1 2 nil 3]

Replacing vectors of numbers with their sums:

= P:Cubed Clojure Language Learning Resources =
(Taken from P-Cubed internal wiki. Public site = www.p-cubed.co.za)
Clojure is a dynamic programming language that targets the Java Virtual Machine (and the CLR, and JavaScript).
It is designed to be a general-purpose language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming.
It also focusses a lot on handling concurrency elegantly.
Taster of the language: http://www.tryclj.com/
While it's dynamically typed by default, it can be optionally statically typed using core.typed.
@logosity
logosity / wait-any.clj
Created August 9, 2013 20:09
Block a caller on any number of long-running/non-terminating functions continuing when any one of them returns (the others will run to completion, or presumably get cleaned up by the calling context):
;;; block caller until any one of the passed functions complets and return its result
(defn wait-any [& fns]
(let [p (promise)]
(doseq [f fns] (future (deliver p (f))))
(deref p)))
;;; (wait-any #(do (Thread/sleep 4000) 1) #(do (Thread/sleep 2000) 2) #(do (Thread/sleep 3000) 3))
;;; output: 2
@pbailis
pbailis / gist:5660980
Last active April 27, 2020 11:46
Assorted distributed database readings

Context: I was asked for a list of interesting reading relating to "distributed databases, behavior under partitions and failures, failure detection." Here's what I came up with in about an hour.

For textbooks, "Introduction to Reliable and Secure Distributed Programming" is a superb introduction to distributed computing from a formal perspective; it's really not about "programming" or "engineering" but about distributed system fundamentals like consensus, distributed registers, and broadcast. Used in Berkeley's Distributed Computing course (and HT to @lalithsuresh) Book Site

Notes from courses like Lorenzo Alvisi's Distributed Computing class can be great.

There are a bunch of classics on causality, [Paxos](ht

@aphyr
aphyr / gist:5333960
Created April 8, 2013 03:10
lolmongo
aphyr@node4:~/riak/rel/riak$ sudo strace -p 1977
Process 1977 attached - interrupt to quit
select(8, [6 7], NULL, NULL, {0, 1370}) = 0 (Timeout)
select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout)
select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout)
select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout)
select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout)
select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout)
select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout)
select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout)
anonymous
anonymous / nn.clj
Created March 24, 2013 16:55
A neural network in Titan and Clojure implementing the xor function
(ns martha.core
(:require [clojurewerkz.titanium.graph :as g]
[clojurewerkz.titanium.vertices :as v]
[clojurewerkz.titanium.edges :as e]
[clojurewerkz.titanium.types :as t]
[ogre.core :as q]))
(def conf {:storage {:backend "embeddedcassandra"
:hostname "127.0.0.1"
:keyspace "martha"
@whoahbot
whoahbot / clojure-west.org
Last active October 13, 2016 07:41
Clojure west notes

Clojure West

Domain driven design with Clojure

  • Organizing larger applications
  • Domain logic shouldn’t include handlers for bad/unclean data.
    • validateur, bouncer, clj-schema for checking data going into the pipeline.
    • domain-specific, semantic checks
    • TODO: Any better ways for doing this conditional validation.
    • Need to factor out common data cleaning utils into shared library.
@pbailis
pbailis / list.md
Last active April 15, 2018 08:54
Quick and dirty (incomplete) list of interesting, mostly recent data warehousing/"big data" papers

A friend asked me for a few pointers to interesting, mostly recent papers on data warehousing and "big data" database systems, with an eye towards real-world deployments. I figured I'd share the list. It's biased and rather incomplete but maybe of interest to someone. While many are obvious choices (I've omitted several, like MapReduce), I think there are a few underappreciated gems.

###Dataflow Engines:

Dryad--general-purpose distributed parallel dataflow engine
http://research.microsoft.com/en-us/projects/dryad/eurosys07.pdf

Spark--in memory dataflow
http://www.cs.berkeley.edu/~matei/papers/2012/nsdi_spark.pdf

anonymous
anonymous / clj_drone.clj
Created January 2, 2013 03:01
Clojure AR Drone Baby Steps
(ns clj-drone.core
(:import (java.net DatagramPacket DatagramSocket InetAddress)))
(def drone-host (InetAddress/getByName "192.168.1.1"))
(def at-port 5556)
(def socket (DatagramSocket. ))
(defn send-command [data]
(.send socket