Skip to content

Instantly share code, notes, and snippets.

View tbatchelli's full-sized avatar

Antoni Batchelli tbatchelli

View GitHub Profile
(comment
;; setting a bunch of attributes
(execute-task my-machine
(set-attributes-task
{:memory-size [(long 1024)]
:cpu-count [(long 2)]
:name ["A new name"]}))
;; getting a bunch of attributes
(execute-task my-machine
(get-attributes-task
;;;;;;;;;;;;
;; pallet ;;
;;;;;;;;;;;;
(ns bacug-haproxy
(:use pallet.maven
[pallet.compute :as compute])
(:require webapp-nodes.nodes))
;; define the compute service, this time form maven settings
(ns bacug
(:use org.jclouds.compute
org.jclouds.aws.ebs
clojure.pprint))
;; define a connection to the cloud provider
(def compute (compute-service "ec2"
"<identity>"
"<credentials>" :ssh))
(comment
(use 'vmfest.virtualbox.virtualbox)
(use 'vmfest.virtualbox.machine)
(use 'vmfest.virtualbox.guest-os-type)
;; find by name or UUID
(def my-machine (find-machine "http://localhost:18083" "" "" "CentOS Minimal"))
;; -> #:vmfest.virtualbox.model.machine{
;; :id "197c694b-fb56-43ed-88f5-f62769134442",
;; :server #:vmfest.virtualbox.model.server{
(defn start
"Starts the virtual machine represented by 'machine'.
Optional parameters are:
:session-type 'gui', 'vrdp' or 'sdl'. Default is 'gui'
:env environment as String to be passed to the machine at startup. See IVirtualbox::openRemoteSession for more details"
[^Machine machine & opt-kv]
(session/with-vbox (:server machine) [mgr vbox]
(let [opts (apply hash-map opt-kv)
machine-id (:id machine)
[laptop:tbatchelli:~/dev/clojur...rates/wordpress]$ mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - org.cloudhoist:wordpress:jar:0.4.0-SNAPSHOT
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [enforcer:enforce {execution: enforce-maven}]
[INFO] [enforcer:enforce {execution: enforce-banned-dependencies}]
[INFO] [enforcer:enforce {execution: enforce-java}]
[INFO] [resources:resources {execution: default-resources}]
@tbatchelli
tbatchelli / test_shell.clj
Created November 28, 2010 03:50
test_shell.clj
(deftest test-set-scope
(let [original-ns *ns*]
(try (in-ns 'outer-test-scope)
(use 'clj-coffeescript.shell)
(is (nil? *runtime*)
"Verify that *runtime* is nil before the test")
(let [outer-ns *ns*
new-scope (new-scope)]
(try
(in-ns 'test-new-scope-ns)
@tbatchelli
tbatchelli / test-google.clj
Created November 29, 2010 01:19
How to get the content of all the links in google's home page.
(use 'clj-coffeescript.shell)
(with-new-scope
(load-library "jquery")
;; load apache.org and collect the text of all the links in that page
(js "window.location='http://google.com'; $('a').text();"))
[laptop:tbatchelli:~/dev/gogrid/simple-test]$ lein pallet -P gogrid-public nodes
Exception in thread "main" java.lang.ClassCastException (NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$null_opt.invoke(main.clj:279)
remote-file /var/lib/ldap/DB_CONFIG...
MD5 sum is 379919de537cf1efc5c1cc54fea605da /var/lib/ldap/DB_CONFIG
ls: /var/lib/ldap/DB_CONFIG.~[0-9]*~: No such file or directory
...done
remote-file /etc/sysconfig/ldap...
--- /etc/sysconfig/ldap 2010-11-29 00:50:22.000000000 -0800
+++ /etc/sysconfig/ldap.new 2011-01-13 13:18:29.000000000 -0800
@@ -1,15 +1,3 @@
-# Parameters to ulimit called right before starting slapd
-# - use this to change system limits for slapd