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 example | |
(:use crane.compute) | |
(:use clojure.contrib.pprint) | |
(:import org.jclouds.compute.domain.OsFamily) | |
(:import org.jclouds.compute.options.TemplateOptions) | |
(:import org.jclouds.logging.log4j.config.Log4JLoggingModule) | |
(:import org.jclouds.ssh.jsch.config.JschSshClientModule) | |
(:import org.jclouds.enterprise.config.EnterpriseConfigurationModule)) | |
(defn load-resource-as-byte-array |
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 with-line-number | |
"Record the source line number" | |
[& body] | |
`(do (defvar- ln# nil) | |
(binding [*script-line* (:line (meta (var ln#))) | |
*script-file* (:file (meta (var ln#)))] | |
~@body))) |
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
(defscript jre-lib-security []) | |
(defimpl jre-lib-security :default [] | |
(str @(update-java-alternatives -l "|" cut "-d ' '" -f 3 "|" head -1) | |
"/jre/lib/security/")) | |
(defn security-file | |
"Installs JCE policy jars (string paths, please) in the remote | |
JAVA_HOME's lib/security directory, enabling the use of \"unlimited strength\" | |
crypto implementations. Options are as for remote-file." | |
[filename & options] |
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 capture-values | |
"Capture the values of the specified symbols in a symbol->value map." | |
[& values] | |
(into {} (map (fn [s] [ `'~s s]) values))) | |
(defn <<! | |
"Interpolate a string given a map of symbol->value" | |
[f value-map] | |
(apply str | |
(map (fn [x] (if (symbol? 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
;; Example for deploying a war file | |
(ns tomcat-deploy | |
(:require | |
[pallet.crate.tomcat :as tomcat] | |
[pallet.core :as core])) | |
(defn deploy-my-file | |
[] | |
(tomcat/deploy-local-file "path to warfile" "appname")) |
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 myns.plugin | |
(:import | |
[maven.clojure.annotations | |
Goal RequiresDependencyResolution Parameter] | |
org.apache.maven.plugin.Mojo)) | |
(deftype | |
#^{Goal "mygoal" | |
RequiresDependencyResolution "compile"} | |
Plugin |
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 repro.repro) | |
;; define a macro and a function that uses it | |
(defmacro my-macro | |
[] | |
`(println "a")) | |
(defn do-macro | |
[] | |
(my-macro)) |
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 pallet.ssh-test | |
(:import | |
[org.jclouds.ssh SshClient ExecResponse] | |
org.jclouds.predicates.SocketOpen | |
org.jclouds.net.IPSocket | |
com.google.inject.Module)) | |
;; define an instance or implementation of the following interfaces: | |
(defn maybe-invoke [f & args] |
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-local | |
"Create a thread local, initialised by body. The value can be obtained by | |
dereferncing the the thread-local with deref/@." | |
[& body] | |
`(proxy [java.lang.ThreadLocal clojure.lang.IDeref] [] | |
(~'initialValue | |
[] ~@body) | |
(~'deref | |
[] (.get ~'this)))) |
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
;;; org-babel-clojure.el --- org-babel functions for clojure evaluation | |
;; Copyright (C) 2009 Joel Boehland | |
;; Author: Joel Boehland | |
;; Keywords: literate programming, reproducible research | |
;; Homepage: http://orgmode.org | |
;; Version: 0.01 | |
;;; License: |