Skip to content

Instantly share code, notes, and snippets.

(defn remove-nil-vals1
[m]
(if-let [s (seq m)]
(persistent! (reduce-kv (fn [acc k v]
(if (nil? v)
acc
(assoc! acc k v)))
(transient (empty m))
m))))
#!/usr/bin/env boot
(require '[clojure.java.io :as io])
(defn inputs
[input-dir]
(->> (io/file input-dir)
file-seq
(filter #(.isFile %))))
@gtrak
gtrak / gist:b2cb99d89b954757c7a2
Last active August 29, 2015 14:18
Mesos for Spark Users - Data Science MD Meetup 4/10/2015
* Mesos for Spark users
- Ben Hindman, started on mesos 2009
- berkeley
- twitter
- multiple 10k+ machines clusters
- Mesos
- 3 Mesos founders now work at Databricks on Spark
- Constraints/Design-goals
- static partitioning considered harmful
- eg. 3 hadoop boxes, 3 spark boxes, etc.
private static class Tuple2<T,U>{
final T v1;
final U v2;
Tuple2(T v1, U v2){
this.v1 = v1;
this.v2 = v2;
}
}
<gtrak> well, I want just a massive queue that has everything.
<gtrak> then my brain can literally be a reactor loop to the universe.
<arrdem> yeah org mode can do that
<gtrak> including tweets and such.
<arrdem> I wish. lemme know and I'll pitch in on the event stream for life project 'cause it's something I've played with as an idea before
<gtrak> It does seem like a good idea, right?
<gtrak> I also want to write code for prioritization.
<arrdem> it's self defeating, because unless you replace yourself the event stream is incomplete
<gtrak> heuristics and stuch.
<arrdem> which is why I haven't built mine yet.
(ns cljs-app.data
(:require [clojure.string :as string]
[cljs-app.node-bits :as node]
[cljs-app.logging :as log]
[cljs.core.async :as async :refer [<! >!]])
(:require-macros [cljs.core :refer [specify!]]
[cljs-app.macros :refer [when-node]]
[cljs.core.async.macros :refer [go go-loop]]))
;; in a macros clj file:
(defn parse-string
[s]
(h/as-hickory (h/parse s)))
(defn link
[entry]
(-> (s/select (s/tag "link")
entry)
first
:attrs
(defn upload [data owner]
(reify
om/IRender
(render [this]
(html [:div {:class "upload"}
[:form {:enc-type "multipart/form-data"
:ref "fileUpload"
:role "form"
:class "form-inline"}
[:div {:class "form-group"}
(defn upload-form-file [node url method on-success]
(.send goog.net.XhrIo "/log/upload"
(fn [e]
(on-success))
"POST"
(new js/FormData node)))
(defn upload [data owner]
(reify
<gtrak> hey, I figured this might be the place to ask, but do bencode and implementations support an empty-list encoding, like 'le'?
<gtrak> because I have one impl that's producing it (clojure), and another that can't read it correctly (emacs elisp), I didn't write either :-)
--> Exancillatus (~Exancilla@127-29-190-109.dsl.ovh.fr) has joined ##bittorrent
<-- Exancillatus (~Exancilla@127-29-190-109.dsl.ovh.fr) has quit (Ping timeout: 264 seconds)
<-- badon (~badon@pdpc/supporter/active/badon) has quit (Ping timeout: 252 seconds)
<TheSHAD0W> Empty list should be in the spec.
<TheSHAD0W> You may need to fix that lisp implementation.
<gtrak> yea, cool.
<gtrak> I'm guessing null isn't :-)
<gtrak> but I can use empty-list for the relevant logic