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
seconds = 356521 | |
days, hours, minutes, seconds = | |
[1.day, 1.hour, 1.minute, 1.second].inject([]) do |acc, unit| | |
quotient, seconds = seconds.divmod unit | |
acc << quotient | |
end |
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
#!/usr/bin/env ruby | |
require 'find' | |
Find.find("/Users/david/Developer") do |path| | |
Dir.chdir(path) do |d| | |
next unless File.exists? ("#{d}/.git") | |
puts d | |
`git pull` | |
Find.prune |
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
#!/usr/bin/env ruby | |
if ARGV.empty? | |
puts "Usage: gemmate <name-of-gem>" | |
else | |
src = `gem which #{ARGV[0]}`.split.last | |
lib_dir = src.slice 0, src.rindex("lib") | |
`mate -a '#{lib_dir}'` | |
end |
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
# xcode noise | |
build/* | |
*.pbxuser | |
*.mode1v3 | |
# old skool | |
.svn | |
# osx noise | |
.DS_Store |
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
*.pbxproj -crlf -diff -merge |
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
BREW_HOME=$HOME/.homebrew | |
$ brew install libxml2 | |
$ brew link libxml2 | |
$ brew install https://github.com/adamv/homebrew-alt/raw/master/duplicates/libxslt.rb | |
$ brew link libxslt | |
$ brew install libiconv | |
$ brew link libiconv | |
$ gem install nokogiri -- --with-xml2-dir=$BREW_HOME/Cellar/libxml2/2.7.8 --with-xslt-dir=$BREW_HOME/Cellar/libxslt/1.1.26 --with-iconv-dir=$BREW_HOME/Cellar/libiconv/1.13.1/ |
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 quickstart.core | |
(:require pallet.core | |
pallet.compute | |
pallet.phase | |
pallet.crate.automated-admin-user)) | |
(def basicnode | |
(pallet.core/node-spec | |
:image {:os-family :ubuntu :os-version-matches "10.10"} | |
:hardware {:min-cores 2 :min-ram 512} |
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 nodes-in-group | |
"Build a list of nodes in a given security-group" | |
[security-group] | |
(filter #(= (% 0) security-group) | |
(map #(vector (pallet.compute/group-name %) | |
(pallet.compute/primary-ip %) | |
(pallet.compute/id %) | |
(pallet.compute.jclouds/node-locations %) ) | |
(pallet.compute/nodes srvc)))) |
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 install-backup-scripts | |
"Creates a script in stevedore and installs it as a shell script in the administrative user's home dir | |
and installs it as a cron. This will override the crontab." | |
[request] | |
(let [administrative-user (:username (pallet.session/admin-user request)) | |
admin-home-dir (str "/home/" administrative-user) | |
raw-instance-id (-> request :target-node (pallet.compute/id)) | |
instance-id (apply str (interpose "_" (clojure.string/split raw-instance-id #"/"))) | |
instance-group (-> request :target-node (compute/group-name)) | |
s3-dir (str "/mnt/s3logstore/" instance-id "." instance-group) |
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
; Get the running nodes and the their ip addresses for the named group | |
; Need to define: | |
; service - the pallet.compute service on which the nodes are running | |
(defn nodes-in-group | |
[group] | |
(filter | |
#(and (.equals group (pallet.compute/group-name %)) | |
(pallet.compute/running? %)) | |
(pallet.compute/nodes service))) |
OlderNewer