Fiction
- Fictions and The Aleph by Borges
- Invisible Cities by Calvino
More Technical
- An Introduction to General Systems Thinking by Weinberg
- Data and Reality by Kent
- Patterns of Software by Gabriel
// A small SSH daemon providing bash sessions | |
// | |
// Server: | |
// cd my/new/dir/ | |
// #generate server keypair | |
// ssh-keygen -t rsa | |
// go get -v . | |
// go run sshd.go | |
// | |
// Client: |
Fiction
More Technical
(comment ; Fun with transducers, v2 | |
;; Still haven't found a brief + approachable overview of Clojure 1.7's new | |
;; transducers in the particular way I would have preferred myself - so here goes: | |
;;;; Definitions | |
;; Looking at the `reduce` docstring, we can define a 'reducing-fn' as: | |
(fn reducing-fn ([]) ([accumulation next-input])) -> new-accumulation | |
;; (The `[]` arity is actually optional; it's only used when calling | |
;; `reduce` w/o an init-accumulator). |
(ns history | |
"Light wrappers and utils for js/history") | |
(defn back! [] (.back js/history)) | |
(defn forward! [] (.forward js/history)) | |
(defn go! [idx] (.go js/history idx)) | |
(defn replace-state! |
It is possible to compile Go programs for a different OS, even though go build
says otherwise.
You'll need:
golang-crosscompile
helper script https://github.com/davecheney/golang-crosscompilepackage main | |
import ( | |
"bufio" | |
"flag" | |
"fmt" | |
"net" | |
"strconv" | |
"strings" | |
"time" |
(defn postfix [& e] | |
(reduce #(if (fn? %2) | |
(let [[l r & m] %] | |
(cons (%2 r l) m)) | |
(cons %2 %)) [] e)) |
Other people's code is awful, and your own code from months previous counts as someone else's. With this and the festive spirit in mind, I dug up a canvas snow demo I made two years ago to see how bad my code really was.
Turns out the performance landscape has changed quite a bit, but after applying a couple of workarounds, best practices, and memory management, I got the demo running smoother than it ever did.
Ugh, I can't believe I just wrote "performance landscape". Anyway...
;; http://www.infoq.com/presentations/core-logic | |
(ns rdf | |
(:refer-clojure :exclude [==]) | |
(:use [clojure.core.logic])) | |
(def g | |
[[:a1 :rdf/type :sdx/FederationService] | |
[:a1 :rdf/type :sdx/name "movies"] | |
[:a1 :rdf/exposedServices :_syscoll1] |
(def ^:private gc-sm-cache! | |
"Maintains maximum cache size by intelligently pruning less valuable items." | |
(let [gc-running? (atom false)] | |
(fn [cache ttl max-items now] | |
(when-not @gc-running? | |
(reset! gc-running? true) | |
(let [snapshot @cache |