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
/* | |
* Copyright 2010 Scott Douglas-Watson | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
;;; qr-encode.el --- | |
;; | |
;; Description: A function for encoding a region into a QR code from emacs. | |
;; Uses java class http://gist.github.com/420377 and core.jar from | |
;; http://code.google.com/p/zxing/ | |
;; | |
;; URL: http://gist.github.com/420386 | |
;; | |
;; Author: Scott Douglas-Watson |
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
(import | |
[java.awt.geom Rectangle2D$Double] | |
[java.awt Dimension Color] | |
[javax.swing JFrame JLabel] | |
[java.io File] | |
[javax.imageio ImageIO]) | |
(defn translate-scale-fn [min max target] | |
(let [scale-factor (/ target (- max min))] | |
(fn [v] |
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
Windows Registry Editor Version 5.00 | |
[HKEY_CURRENT_USER\Keyboard Layout] | |
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00 |
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 neighbours-fn [w h n] | |
(letfn [(has-w [i] (not (zero? (rem i w)))) | |
(pos-w [i] (dec i)) | |
(has-n [i] (>= i w)) | |
(pos-n [i] (- i w)) | |
(has-e [i] (not (zero? (rem (inc i) w)))) | |
(pos-e [i] (inc i)) | |
(has-s [i] (< i (* w (dec h)))) | |
(pos-s [i] (+ i w))] | |
(let [pred-pos-m {:w [has-w pos-w] |
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 stats) | |
(defn mode [vs] | |
(let [fs (frequencies vs)] | |
(first (last (sort-by second fs))))) | |
(defn quantile | |
([p vs] | |
(let [svs (sort vs)] | |
(quantile p (count vs) svs (first svs) (last svs)))) |
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 scottdw.image | |
(:import | |
[java.awt Color Image Dimension] | |
[java.awt.image BufferedImage] | |
[java.io File] | |
[javax.imageio ImageIO] | |
[javax.swing JFrame JPanel]) | |
(require [scottdw.stats :as stats])) | |
(defn read-image [^String filename] |
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 scottdw.plot.demo | |
(:import [java.util Random] | |
[org.jzy3d.analysis AnalysisLauncher AbstractAnalysis] | |
[org.jzy3d.chart Chart] | |
[org.jzy3d.chart.factories AWTChartComponentFactory] | |
[org.jzy3d.colors Color ColorMapper] | |
[org.jzy3d.colors.colormaps ColorMapRainbow] | |
[org.jzy3d.maths Coord3d Range] | |
[org.jzy3d.plot3d.builder Builder Mapper] | |
[org.jzy3d.plot3d.builder.concrete OrthonormalGrid] |
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 scottdw.mmgr.gl | |
(:import [javax.media.opengl DebugGL3 GL GL2 GL3 GLAutoDrawable GLCapabilities GLEventListener GLProfile] | |
[com.jogamp.newt NewtFactory] | |
[com.jogamp.newt.event WindowAdapter WindowEvent] | |
[com.jogamp.newt.opengl GLWindow]) | |
(:require [clojure.java.io :as io] | |
[taoensso.timbre :as timbre :refer (trace debug error)])) | |
(defn create-shader [^GL3 gl resource type] | |
(let [source (slurp (io/resource resource)) |
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 scottdw.jpeg | |
(:import [clojure.lang Keyword] | |
[com.drew.imaging ImageMetadataReader] | |
[com.drew.metadata Directory Metadata Tag] | |
[java.net URI] | |
[java.nio ByteBuffer] | |
[java.nio.file Files Paths]) | |
(:require [clojure.java.io :as io])) | |
(defn read-metadata [^String file-name] |
OlderNewer