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
/*** ground ***/ | |
ha = 33.3; // hill angle in degrees | |
hl = 1600; // hill length in cm | |
hw = 2821; // hill width in cm | |
hh = sin(ha)*hl; // hill height in cm | |
hd = cos(ha)*hl; // hill depth in cm | |
color("ForestGreen") | |
union() { |
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
@RequestMapping("zencoder.htm") | |
public void zen(final HttpServletRequest request, final HttpServletResponse response) throws AttachSystemFileException, IOException { | |
final String body = IOUtils.toString(request.getReader()); | |
logger.info("Received Zencoder notification:\n" + body); | |
final Notification notification = zen.notification(body); | |
final Job job = notification.getJob(); | |
final Output output = notification.getOutput(); | |
final String filename = decodeLabel(output.getLabel()); | |
if (job.isFinished()) { | |
logger.debug("zen CALL downloader.execute filename: " + 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
(defn- char-range [start end] | |
(map char (range (int start) | |
(inc (int end))))) | |
(def ^:private | |
dirty | |
(char-range \! \~)) | |
(def ^:private | |
clean |
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- with-index | |
"Maps a token's sequential position to its | |
entry." | |
[{:keys [count] :as accum} x] | |
(-> accum | |
(update-in [:by-index] assoc (inc count) x) | |
(update-in [:count] inc))) | |
(defn- with-key | |
"Maps a token's normalized string-based key |
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 aws.s3 | |
(:refer-clojure :exclude [get]) | |
(:use [clojure.walk :only (keywordize-keys stringify-keys)] | |
[clojure.contrib.def :only (defonce-)] | |
[clojure.contrib.json :only (read-json write-json)]) | |
(:import [java.io PrintWriter InputStreamReader ByteArrayInputStream ByteArrayOutputStream] | |
[java.util.zip GZIPInputStream GZIPOutputStream] | |
[com.google.common.base Charsets] | |
[com.amazonaws.services.s3 AmazonS3Client] | |
[com.amazonaws.services.s3.model Region CreateBucketRequest ObjectMetadata |
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
;; See http://en.wikipedia.org/wiki/Geographic_coordinate_conversion | |
(defn dms [type degrees] | |
{:pre [(#{:latitude :longitude} type)]} | |
"Conversion from Decimal Degree to DMS (Degrees, Minutes, Seconds)" | |
(let [total-sec (Math/round (* (Math/abs degrees) 60 60)) | |
total-min (quot total-sec 60) | |
sec (rem total-sec 60) | |
min (rem total-min 60) | |
deg (quot total-min 60)] |
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
// | |
// Lexical Analyzer for Scheme R5RS | |
// | |
// TODO: numbers, better error reporting | |
// | |
// Depends on Functional Javascript: http://osteele.com/sources/javascript/functional/ | |
// | |
Functional.install(); |
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
insertTemplate :: Template -> IO () | |
insertTemplate (Template _ src) = do | |
conn <- connectPostgreSQL "hostaddr=127.0.0.1 dbname=sandbox user=postgres password=" | |
insertTemplateStmt <- prepare conn "INSERT INTO templates VALUES (?, ?)" | |
pk <- friendlyId 6 | |
execute insertTemplateStmt [toSql pk, toSql src] | |
commit conn | |
disconnect conn |
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 mc.core | |
(:use [clojure.contrib.seq-utils :only [separate]])) | |
; http://math.fullerton.edu/mathews/n2003/MonteCarloPiMod.html | |
(defn- square [x] | |
(* x x)) | |
(defn- distance [[x y]] | |
(Math/sqrt (+ (square x) |
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
;; http://aperiodic.net/phil/scala/s-99/ | |
; last | |
(defn p01 [[x & xs]] | |
(if xs (recur xs) x)) | |
(defn p02 [xs] | |
(p01 (butlast xs))) | |
; nth |
NewerOlder