Skip to content

Instantly share code, notes, and snippets.

View tbatchelli's full-sized avatar

Antoni Batchelli tbatchelli

View GitHub Profile
@tbatchelli
tbatchelli / gist:1153299
Created August 18, 2011 04:36
updated basic project
(defproject basic "0.4.0"
:description "Basic Pallet Usage"
:dependencies [[org.cloudhoist/pallet "0.6.2"]
[org.cloudhoist/pallet-crates-standalone "0.5.0"]
[org.jclouds/jclouds-allcompute "1.1.1"]
[log4j/log4j "1.2.14"]]
:dev-dependencies [[swank-clojure/swank-clojure "1.2.1"] ; swank
[vmfest "0.2.2"] ; virtualbox
[org.cloudhoist/pallet-lein "0.4.1"] ; lein
[cake-pallet "0.4.0"]] ; cake
@tbatchelli
tbatchelli / gist:1059162
Created July 1, 2011 18:49
hadoop cluster example
(cluster-spec :private
{:jobtracker (node-group [:jobtracker :namenode])
:slaves (slave-group 2)}
:base-machine-spec {:os-family :ubuntu
:os-version-matches "10.10"
:os-64-bit true
:min-ram (* 4 1024)}
:base-props {:hdfs-site {:dfs.data.dir "/mnt/dfs/data"
:dfs.name.dir "/mnt/dfs/name"}
:mapred-site {:mapred.task.timeout 300000
{:vmfest-Ubuntu-10-10-64bit
{:uuid
"/Users/tbatchelli/.vmfest/models/vmfest-Ubuntu-10-10-64bit.vdi",
:description "hello",
:os-type-id "Ubuntu_64"},
:vmfest-ubuntu-10-10-64bit-server
{:os-type-id "Ubuntu_64",
:sudo-password "superduper",
:no-sudo false,
:username "user",
(defn debug [req comment & [key-vec]]
(println "***" comment (or key-vec "(full request)"))
(if key-vec
(pprint (get-in req key-vec))
(pprint req))
req)
(defn add-slave [req]
(let [target-node (:target-node req)
(ns example.core
(:use [pallet.core :only (defnode converge lift)]
[pallet.resource :only (phase)]
[pallet.compute :as compute]
[pallet.resource.remote-file :as remote-file]
[pallet.crate.automated-admin-user :only (automated-admin-user)]
clojure.pprint)
(:require [pallet.parameter :as parameter]
[pallet.resource :as resource]))
#!/bin/bash
# register-vm.sh <path-to-vm> [<dest-dir>] (default dest-dir is ~/vmfest)
models_dir={$2-~/vmfest}/models
nodes_dir={$2-~/vmfest}/nodes
mkdir -p $models_dir
mkdir -p $nodes_dir
echo "Registering image $1"
source_path=$1
file_name=$(basename $source_path)
dest_path=$models_dir/$file_name
# WELCOME TO SQUID 2.7.STABLE9
# ----------------------------
#
# This is the default Squid configuration file. You may wish
# to look at the Squid home page (http://www.squid-cache.org/)
# for the FAQ and other documentation.
#
# The default Squid config file shows what the defaults for
# various options happen to be. If you don't need to change the
@tbatchelli
tbatchelli / pallet-vmfest.md
Created March 12, 2011 20:25
Setup pallet with vmfest
  1. Install VirtualBox on your machine
  2. Disable login credential: $ VBoxManage setproperty websrvauthlibrary null
  3. Download and uncompress the following image https://s3.amazonaws.com/vmfest-images/ubuntu-10-10-64bit-server.vdi.gz
  4. Clone the image to the directory where you want it to be permanently stored: $ VBoxManage clonehd /path/to/downloaded/ubuntu-10-10-64bit-server.vdi /path/to/permanent/location/ubuntu...-server.vdi
    • This should produce a uuid for your new image. Keep it around
  5. Start VirtualBox (the GUI) and:
    1. Create an new image Linux - Ubuntu (64bit)
  6. Select "Use existing hard disk" and if your newly cloned image doesn't appear in the drop-down list, click on the folder icon and find the image in your hard disk (the one you just cloned)
cat > /tmp/hadoop-site.xml.new <<EOFpallet
<?xml version="1.0" encoding="UTF-8"?><configuration><property><name>dfs.datanode.du.reserved</name><value>1073741824</value><final>true</final></property><property><name>mapred.child.ulimit</name><value>1126400</value><final>true</final></property><property><name>mapred.local.dir</name><value>/tmp/hadoop//hadoop/hdfs/mapred/local</value><final>true</final></property><property><name>dfs.name.dir</name><value>/tmp/hadoop//hadoop/hdfs/name</value><final>true</final></property><property><name>dfs.permissions</name><value>true</value><final>true</final></property><property><name>io.file.buffer.size</name><value>65536</value></property><property><name>mapred.child.java.opts</name><value>-Xmx550m</value></property><property><name>ndfs.block.size</name><value>134217728</value></property><property><name>dfs.replication</name><value></value></property><property><name>dfs.data.dir</name><value>/tmp/hadoop//hadoop/hdfs/data</value><final>true</final></property><property><name>t
[tbatchelli@29785_1_103 ~]$ ldapsearch -w fred -D "cn=Manager,dc=gogrid,dc=com" -x -l 10 -s base -b cn=Monitor "(objectClass=*)" "@monitorServer"
# extended LDIF
#
# LDAPv3
# base <cn=Monitor> with scope baseObject
# filter: (objectClass=*)
# requesting: @monitorServer
#
# Monitor