Important organizational announcement Due to feedback from several people who wish to contribute, this project is being moved to it's own repository. The master copy is now at SalusaSecondus/CryptoGotchas. This will let us more easily take PRs/Issues and track contributions.
nREPL server started on port 64499 on host 127.0.0.1 - nrepl://127.0.0.1:64499 | |
REPL-y 0.3.1 | |
Clojure 1.7.0-alpha6 | |
Reflection warning, /tmp/form-init8946539659736038022.clj:1:1389 - reference to field ns can't be resolved. | |
Reflection warning, /tmp/form-init8946539659736038022.clj:1:3631 - reference to field name can't be resolved. | |
Docs: (doc function-name-here) | |
(find-doc "part-of-name-here") | |
Source: (source function-name-here) | |
Javadoc: (javadoc java-object-or-class-here) | |
Exit: Control+D or (exit) or (quit) |
{-# LANGUAGE InstanceSigs, OverloadedStrings #-} | |
module Text.Parser.Selmer where | |
import Control.Applicative | |
import Data.Char (isAlpha) | |
import Data.Map.Lazy (Map) | |
import qualified Data.Map.Lazy as M | |
import Data.Maybe (fromMaybe) | |
import Data.Monoid |
(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). |
After an initial "sprint" (a block of days I've been able to allocate to Enliven dev), I've only been able to work on it on and off hence the slow pace of development.
Locally I've been refactoring and learning from the initial code burst. I've been experimenting too, especially with several flavors of encoding composition:
- pre-rendering constant parts as bytes
- pre-rendering constant parts as gzipped bytes (moderate success: it works but needs work to, at least, trigger this only on constant strings above a given threshold)
- pre-rendering constant parts as direct bytebuffers and rendering the whole template as an array of bytebuffers to leverage vectored IO (aka gather IO)
However the current goal is to add dynamic (reactive) templating.
From an abstract point of view I try to make Enliven's core a meta templating system. (Currently there's only static html and static text.)
(defun read-hash-list (stream) | |
(read-delimited-list #\} stream)) | |
(defun make-read-hash-table (stream char) | |
(declare (ignore char)) | |
(let ((a-list (read-hash-list stream)) | |
(ht (make-hash-table))) | |
(assert (evenp (length a-list))) | |
(loop for i = 0 then (+ i 2) until (= i (length a-list)) | |
do (setf (gethash (elt a-list i) ht) |
# Damerau-Levenshtein edit distance implementation | |
# Based on pseudocode from Wikipedia: https://en.wikipedia.org/wiki/Damerau-Levenshtein_distance | |
def damerau_levenshtein_distance(a, b): | |
# "Infinity" -- greater than maximum possible edit distance | |
# Used to prevent transpositions for first characters | |
INF = len(a) + len(b) | |
# Matrix: (M + 2) x (N + 2) | |
matrix = [[INF for n in xrange(len(b) + 2)]] |
Red Team versus the Agents
At a nuclear weapons lab, a team of elite hackers matches wits with undefeated autonomous defenders
ALBUQUERQUE, N.M.--By the time my escort steers me past the armed guards, key-coded doors, and bags of shredded paper into the heart of Sandia National Laboratories, the rematch has already begun. Inside the Advanced Information Systems Lab, six men sit around a large table loaded with laptops and network cables, which snake over to a rack of high-powered machines labeled BORG SERVER CLUSTER. These men are the defense--the Blue Team in this high-tech version of capture the flag--and they lean back in their chairs confidently. This past March, they claim, their "agents"--computer programs that autonomously cooperate to protect a networked system--became the first defenders ever to thwart Sandia's esteemed Red Team of professional hackers. But that was in a two-day skirmish. Now Steven Y. Goldsmith, the research group's lead scientist, has invited the Red Team to spend this entire we