This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn capture-image | |
"Capture an image of specified size from the primary screen at specified point" | |
[from-x from-y x-size y-size] | |
(let [rob (java.awt.Robot.) | |
rect (java.awt.Rectangle. from-x from-y x-size y-size)] | |
(. rob createScreenCapture rect))) | |
(defn grab-screen | |
"Capture the entire primary screen and return BufferedImage" | |
[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn fold-into-vec [coll] | |
"Provided a reducer, concatenate into a vector. | |
Note: same as (into [] coll), but parallel." | |
(r/fold (r/monoid into vector) conj coll)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn rindex-by-fn | |
"Uses core.reducers/fold to return a map indexed by the value of key-fn | |
applied to each element in coll. | |
Note: key-fn can return a collection of multiple keys." | |
([key-fn coll ] (rindex-by-fn key-fn identity coll)) | |
([key-fn value-fn coll] (doall (clojure.core.reducers/fold | |
;; combinef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Must install libusb library via your favorite package manager | |
# Then install libusb ruby gem, via $ sudo gem install libusb | |
require 'libusb' | |
# Call provided blocks when key is pressed or released | |
def handle_pedal(device, onpress, onrelease) | |
device.open do |h| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro thread | |
"Execute the following S-EXP in another thread, and return thread" | |
[sexp] | |
`(let [thread# (java.lang.Thread. (fn [] ~sexp))] | |
(.start thread#) | |
thread#)) | |
(defn fold-into-lazy-seq | |
"Accept a reducible sequence, and produce a lazy-seq of it's results. | |
Order *NOT* guarranteed!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns api-tunnel.http | |
(:require [compojure.route :as route] | |
[compojure.handler :as handler]) | |
(:use org.httpkit.server | |
[datomic.api :only [db q] :as d] | |
)) | |
;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; - |