This file contains hidden or 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
#!/bin/sh | |
# Starter script for Clojure liverepl | |
[ -z "$JDK_HOME" ] && JDK_HOME=/usr/lib/jvm/default-java | |
LIVEREPL_HOME="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" | |
CLOJURE_JAR="$LIVEREPL_HOME/clojure.jar" | |
if [ ! -f "$JDK_HOME/lib/tools.jar" ]; then | |
echo 'Unable to find $JDK_HOME/lib/tools.jar' | |
echo "Please set the JDK_HOME environment variable to the location of your JDK." |
This file contains hidden or 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
// simplified and fixed bug where too many \b characters were printed | |
#include <stdio.h> | |
#include <unistd.h> | |
int main (int argc, const char *argv[]) | |
{ | |
int i; | |
const char scroller[] = "|/-\\"; | |
for(i=0; i<20; ++i) { | |
printf("%c", scroller[i % (sizeof(scroller) - 1)]); |
This file contains hidden or 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
# wget with notifications! | |
function wget() { | |
command wget "$@" | |
ret=$? | |
notify-send -i $HOME/.icons/down.svg "Download complete" "wget $*" &> /dev/null | |
return $ret | |
} |
This file contains hidden or 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
(def randArray | |
(for [y (range 100)] | |
(persistent! | |
(reduce (fn [v _] (conj! v (rand))) | |
(transient []) (range (* 100 1000)))))) | |
(def sums (map #(reduce + %) randArray)) | |
(time (dorun (map println sums))) |
This file contains hidden or 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 dostuff [] | |
(couch/get document-id) | |
(couch/set document-id)) | |
(defn dootherstuff [] | |
(couch/get document-id)) | |
(defn main [] | |
(couch/with-couch host db | |
(dostuff) |
This file contains hidden or 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 esj-problem | |
[n limit s] | |
(if-not (seq s) ; reached end of input? | |
(when-not (zero? n) ; if there's anything left-over return it | |
(list n)) | |
(if (>= n limit) ; have we reached the limit? | |
(lazy-seq ; if so, spit out a new output | |
(cons n (esj-problem 0 limit s))) | |
; haven't reached limit, gobble some more input | |
(recur (+ n (first s)) limit (next s))))) |
This file contains hidden or 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 one [] | |
"a one") | |
(defmacro two [] | |
"and a two") | |
(defmacro whee [sym] | |
`(~sym)) | |
(defmacro wheez [s] |
This file contains hidden or 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
;; (based on http://github.com/technomancy/leiningen) | |
;; | |
;; Base changes: | |
;; | |
;; - defproject becomes defjar (allow multiple jars per project) | |
;; | |
;; - use group.id/jarname "1.0" instead of ["group.id" "jarname" "version"] | |
;; more clojureish and easier to type | |
;; | |
;; - drop :version keyword, version should always be required so it's |
This file contains hidden or 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 make-repo | |
"Does the crazy factory voodoo necessary to get an ArtifactRepository object." | |
[id url] | |
(-> (.lookup container ArtifactRepositoryFactory/ROLE) | |
(.createDeploymentArtifactRepository | |
id url (.lookup container ArtifactRepositoryLayout/ROLE "default") true))) |
This file contains hidden or 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
% scp compojure/pom.xml compojure/target/compojure-0.3.1.jar clojureql/jarspec.clj clojureql/build/clojureql.jar [email protected]: | |
Welcome to Clojars, ato! | |
pom.xml 100% 2610 2.6KB/s 00:00 | |
compojure-0.3.1.jar 100% 451KB 451.4KB/s 00:00 | |
jarspec.clj 100% 219 0.2KB/s 00:00 | |
clojureql.jar 100% 206KB 205.9KB/s 00:00 | |
Deploying org.clojars.ato/compojure 0.3.1 | |
[INFO] Uploading project information for compojure 0.3.1 | |
[INFO] Retrieving previous metadata from clojars |
OlderNewer