This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
(require '[datomic.api :as d] | |
'[clojure.string :as str]) | |
(defn normalize-query | |
"Turns a vector formatted Datomic datalog query into a map formatted | |
one." | |
[query] | |
(let [pairs (partition-by keyword? query)] | |
(assert (even? (count pairs))) | |
(into |
#!/bin/sh | |
# Ensures libvips is installed and attempts to install it if not | |
# Currently supports: | |
# * Debian Linux | |
# * Debian 7, 8 | |
# * Ubuntu 12.04, 14.04, 14.10, 15.04 | |
# * Mint 13, 17 | |
# * Red Hat Linux | |
# * RHEL/Centos/Scientific 6, 7 | |
# * Fedora 21, 22 |
(ns datascript-to-datomic-util | |
(:require [datascript :as d])) | |
;;;; a utility to help with a datomic-datascript roundtrip process involving: | |
;;; 1. export some data from a datomic database and transact into a datascript instance. | |
;;; 2. perform one or more transactions against datascript. | |
;;; 3. transact the sum of all changes made against datascript back into datomic in a single tx | |
;;; this namespace contains two public functions: | |
;;; listen-for-changes: listen to datascript transactions and build up a record of changes |
-- Optimized MYSQL schema for datomic | |
-- Unfortunately the bin/sql/mysql-*.sql bootstrapping files for datomic are not | |
-- very good, and can actually cause failures if not adjusted. | |
-- One symptom of this is the following error: | |
-- SQL Error (1071): Specified key was too long; max key length is 767 bytes. | |
-- Reported here: https://support.cognitect.com/entries/28462168-MySQL-Caveats | |
-- This is caused by the default collation for the `id` column possibly being |
commit 8e51c34ca4d97e48750850d5ba09956f89783b4e | |
Author: Kyle Kingsbury <aphyr@aphyr.com> | |
Date: Wed May 7 19:06:15 2014 -0700 | |
Improve Keyword.intern performance | |
Keyword interning is an expensive factor in many Clojure | |
serialization/deserialization paths, especially where the same set of | |
keywords are created and freed repeatedly; e.g. iterating over records | |
with similar structure. There are two principle costs to keyword |
function parseVideo (url) { | |
// - Supported YouTube URL formats: | |
// - http://www.youtube.com/watch?v=My2FRPA3Gf8 | |
// - http://youtu.be/My2FRPA3Gf8 | |
// - https://youtube.googleapis.com/v/My2FRPA3Gf8 | |
// - Supported Vimeo URL formats: | |
// - http://vimeo.com/25451551 | |
// - http://player.vimeo.com/video/25451551 | |
// - Also supports relative URLs: | |
// - //player.vimeo.com/video/25451551 |
#!/usr/bin/env python | |
import SimpleHTTPServer, BaseHTTPServer, SocketServer, socket, time, sys | |
class ThreadedHTTPServer(SocketServer.ThreadingMixIn, | |
BaseHTTPServer.HTTPServer) : | |
""" | |
New features w/r to BaseHTTPServer.HTTPServer: | |
- serves multiple requests simultaneously | |
- catches socket.timeout and socket.error exceptions (raised from |
(ns n01se.externs-for-cljs | |
(:require [clojure.java.io :as io] | |
[cljs.compiler :as comp] | |
[cljs.analyzer :as ana])) | |
(defn read-file [file] | |
(let [eof (Object.)] | |
(with-open [stream (clojure.lang.LineNumberingPushbackReader. (io/reader file))] | |
(vec (take-while #(not= % eof) | |
(repeatedly #(read stream false eof))))))) |
#!/usr/bin/python | |
# | |
# K-means clustering using Lloyd's algorithm in pure Python. | |
# Written by Lars Buitinck. This code is in the public domain. | |
# | |
# The main program runs the clustering algorithm on a bunch of text documents | |
# specified as command-line arguments. These documents are first converted to | |
# sparse vectors, represented as lists of (index, value) pairs. | |
from collections import defaultdict |