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
if node[:ec2][:ephemeral][:devices].include?("/dev/sdd") | |
# if we also have sdd and sde, raid0 them and put data there | |
data_raid_block_devs = [ "/dev/sdd", "/dev/sde" ] | |
data_raid_mountpoint = "/mnt/cassandra_data" | |
data_raid_dev = "/dev/md0" | |
data_file_dir = Array(node[:cassandra][:data_file_dirs]).first | |
package "mdadm" do | |
action :install | |
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
"map": "function(doc) { if (doc.type == 'lock') { emit(doc.message_id, null) } else { emit(doc._id, doc) } }", | |
"reduce": "function(keys, values, rereduce) { if (values.length == 1) return values[0] }" |
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
# class Person | |
# include SearchableModel | |
# include SearchableModel::SearchMethods | |
# | |
# ... | |
# | |
# end | |
module SearchableModel |
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
# use for oneshot recipes | |
if node[:oneshot] | |
# clear oneshot and save node | |
oneshot, node[:oneshot] = node[:oneshot], [] | |
node.save | |
oneshot.each do |recipe| | |
include_recipe recipe | |
end | |
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
curl -XPUT localhost:9200/_river/couch/_meta -d '{ | |
"type" : "couchdb", | |
"couchdb" : { | |
"host" : "localhost", | |
"port" : 5984, | |
"db" : "chef", | |
"filter" : null, | |
"script": "ctx._type = ctx.doc.chef_type" | |
}, | |
"index" : { |
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
# run from rails root | |
Dir.glob("app/views/**/*.*").each do |filename| | |
File.open(filename) do |f| | |
f.each_with_index do |line, i| | |
line.scan /[^"]"([^"]+)"/ do |match| | |
m = match.first | |
puts "#{f.path} :#{i+1} #{m}" if m =~ /(<[^%]|[^=%]>)/ | |
end | |
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
module Celluloid | |
class OneShotTimer | |
include Celluloid | |
def initialize(timeout) | |
@timeout = timeout | |
end | |
def fire | |
puts "fired" |
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
module Celluloid | |
class Scheduler | |
def initialize | |
read, @write = IO.pipe | |
@pool = TimerPool.new(read) | |
at_exit { stop } | |
end | |
def start |
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
Celluloid::ZMQ::Mailbox | |
behaves like a Celluloid Mailbox | |
receives messages | |
raises system events when received | |
prioritizes system events over other messages | |
selectively receives messages with a block | |
DCell::Node | |
looks up remote actors (FAILED - 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
require "chef/handler" | |
class StatusAttributeHandler < Chef::Handler | |
VERSION = "0.0.1" | |
DEFAULTS = { | |
:attribute_name => 'status', | |
:success_status => 'UP' | |
} |