Skip to content

Instantly share code, notes, and snippets.

Keith Irwin zentrope

Block or report user

Report or block zentrope

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zentrope
zentrope / get-bars.clj
Last active Dec 12, 2015
Stringing out XML blobs
View get-bars.clj
#!/usr/bin/env clj
(defn get-bars
[xml]
(loop [xml xml
bars []]
(if (clojure.string/blank? xml)
bars
(let [[_ bar xml2 :as r] (clojure.string/split xml #"<bar>|</bar>" 3)]
(if (nil? bar)
@zentrope
zentrope / Vagrantfile
Created Oct 23, 2015
Vagrant file for FreeBSD on OS X
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.guest = :freebsd
config.vm.box = "freebsd/FreeBSD-10.2-RELEASE"
@zentrope
zentrope / cipher.sh
Last active Oct 21, 2015
nginx, mont and shell for running and monitoring a java process on a unix (FreeBSD) system
View cipher.sh
#!/bin/sh
app="cipher"
version="0.9.2"
java="/usr/local/bin/java"
daemon="/usr/sbin/daemon"
app_home="/home/vagrant/apps/${app}"
jar="${app}-${version}-standalone.jar"
@zentrope
zentrope / Makefile
Last active Sep 6, 2015 — forked from rauhs/Makefile
Compiling clojurescript + figwheel without boot nor leiningen. Using leiningen to manage dependencies.
View Makefile
CLJ_NREPL_PORT:=22340
CLJS_JAR_VERSION:=1.7.48
CLJS_JAR_URL:=https://github.com/clojure/clojurescript/releases/download/r$(CLJS_JAR_VERSION)/cljs.jar
.PHONY: def_target
def_target : null
# http://blog.jgc.org/2015/04/the-one-line-you-should-add-to-every.html
@zentrope
zentrope / alpha3-fail.txt
Last active Aug 31, 2015
Stacktrace when compiling ClojureScript 1.7.122 with Clojure 1.8.0-alpha3 (also alpha4). Alpha2 works. Same error with JDK7 or 8.
View alpha3-fail.txt
Compiling ClojureScript...
Exception in thread "main" java.lang.VerifyError: (class: cljs/util$last_modified, method: invokeStatic signature: (Ljava/lang/Object;)Ljava/lang/Object;) Can only throw Throwable objects, compiling:(util.cljc:142:1)
at clojure.lang.Compiler$DefExpr.eval(Compiler.java:468)
at clojure.lang.Compiler.eval(Compiler.java:6948)
at clojure.lang.Compiler.load(Compiler.java:7390)
at clojure.lang.RT.loadResourceScript(RT.java:372)
at clojure.lang.RT.loadResourceScript(RT.java:363)
at clojure.lang.RT.load(RT.java:453)
at clojure.lang.RT.load(RT.java:419)
at clojure.core$load$fn__5436.invoke(core.clj:5869)
@zentrope
zentrope / gambit-3.clj
Last active Aug 29, 2015
file-atom: core.async, promises, atomic-reference
View gambit-3.clj
(ns afile.gambit-3
(:refer-clojure :exclude [deref])
(:require
[clojure.edn :as edn]
[clojure.pprint :refer [pprint]]
[clojure.core.async :refer [go <! put! chan]]
[clojure.test :refer [deftest is run-tests]]))
(defn- load-file!
[file init-value]
@zentrope
zentrope / gambit-1.clj
Created Mar 20, 2015
agent version of file based atom
View gambit-1.clj
(ns afile.gambit-1
(:refer-clojure :exclude [deref])
(:require
[clojure.edn :as edn]
[clojure.pprint :refer [pprint]]
[clojure.test :refer [deftest is run-tests]]))
(defn- load-file!
[file init-value]
(if (.exists file)
@zentrope
zentrope / file-backed-atom2.clj
Last active Aug 29, 2015
file-backed-atom2.clj
View file-backed-atom2.clj
(ns afile.core
(:refer-clojure :exclude [deref])
(:require
[clojure.edn :as edn]
[clojure.pprint :refer [pprint]]
[clojure.test :refer [deftest is run-tests]]))
(defn- load-file!
[fname init-value]
(let [f (java.io.File. fname)]
View file-backed-atom.clj
(ns afile.core
(:require
[clojure.edn :as edn]
[clojure.pprint :refer [pprint]]
[clojure.test :refer [deftest is run-tests]]))
(defn- load-file!
[fname init-value]
(let [f (java.io.File. fname)]
(if (.exists f)
@zentrope
zentrope / offscreen.js
Created Jan 18, 2015
three.js detect off-screen objects?
View offscreen.js
var frustum = new THREE.Frustum();
var cameraViewProjectionMatrix = new THREE.Matrix4();
// every time the camera or objects change position (or every frame)
camera.updateMatrixWorld(); // make sure the camera matrix is updated
camera.matrixWorldInverse.getInverse( camera.matrixWorld );
cameraViewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
frustum.setFromMatrix( cameraViewProjectionMatrix );
You can’t perform that action at this time.