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 Task < Ohm::Model | |
include Comparable | |
attribute :url | |
attribute :eta | |
attribute :params | |
attribute :queue_name | |
index :url | |
index :eta |
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
#!/bin/sh | |
yum install -y wget ntp | |
source "/var/spool/ec2/meta-data.sh" | |
echo "$EC2_LOCAL_IPV4 $HOST_NAME" >> /etc/hosts | |
hostname $HOST_NAME | |
echo "HOSTNAME=$HOST_NAME" >> /etc/sysconfig/network |
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 'aws' | |
namespace :aws do | |
task :create_snapshot do | |
instances.each do |instance| | |
ec2 = ec2_connect | |
volume_ids = find_volume_ids_for_instance(instance) | |
if volume_ids | |
volume_ids.each do |volume_id| |
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
#!/bin/bash | |
source /etc/profile | |
for ruby_package in ruby-ri-1.8.5 ruby-rdoc-1.8.5 ruby-irb-1.8.5 ruby-docs-1.8.5 ruby-tcltk-1.8.5 ruby-1.8.5 ruby-mode-1.8.5 rrdtool-ruby-1.2.27 ruby-devel-1.8.5.x86_64 ruby-devel-1.8.5.i386 ruby-libs-1.8.5.x86_64 ruby-libs-1.8.5.i386 | |
do | |
if rpm -q $ruby_package >/dev/null; then | |
echo $ruby_package | |
rpm -e $ruby_package; | |
fi |
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
#!/bin/bash | |
source /etc/profile | |
for ruby_package in ruby-ri-1.8.5 ruby-rdoc-1.8.5 ruby-irb-1.8.5 ruby-docs-1.8.5 ruby-tcltk-1.8.5 ruby-1.8.5 ruby-mode-1.8.5 rrdtool-ruby-1.2.27 ruby-devel-1.8.5.x86_64 ruby-devel-1.8.5.i386 ruby-libs-1.8.5.x86_64 ruby-libs-1.8.5.i386 | |
do | |
if rpm -q $ruby_package >/dev/null; then | |
echo $ruby_package | |
rpm -e $ruby_package; | |
fi |
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 'rubygems' | |
require 'main' | |
require 'xmpp4r' | |
require File.dirname(__FILE__) + "/nagios_helpers" | |
class NoErrorsFoundInLogs < Exception; | |
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
class LRUMemoryStore < ActiveSupport::Cache::Store | |
def initialize(max_size = 1000) | |
@max_size = max_size | |
@data = {} | |
@lru = [] | |
end | |
def read(name, options = nil) | |
super |
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 ActiveRecord::ConnectionAdapters::MysqlAdapter | |
def create_partitioned_table(table_name, &block) | |
partition_sql = <<-sql | |
ENGINE=InnoDB AUTO_INCREMENT=610925 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci | |
partition by range (to_days(created_at)) | |
( | |
partition p_0 values LESS THAN (to_days('2000-01-01')), | |
sql | |
partitions = (-4..4).collect do |i| |
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
public Set<OutboundTask> add(LinkedHashSet<T> itemsToFilter) { | |
LinkedHashMultimap<Stream<T>, T> filteredItems = Multimaps.newLinkedHashMultimap(); | |
Set<OutboundTask> outboundTasks = Sets.newHashSet(); | |
for (T filterable : itemsToFilter) { | |
filterAction(filteredItems, filterable); | |
filterActor(filteredItems, filterable); | |
filterTag(filteredItems, filterable); | |
filterTo(filteredItems, filterable); | |
filterRegarding(filteredItems, filterable); |
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
create trigger activity_duplicate_check before insert on activities | |
for each row begin | |
set @activity_id=new.activity_id; | |
set @poll_result_id=new.poll_result_id; | |
set @created_at=new.created_at; | |
set @data_collector_id=new.data_collector_id; | |
begin | |
declare found_ids int default 0; | |
declare found_created_at datetime default 0; |
OlderNewer