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
check process redis-server | |
with pidfile "/var/run/redis/redis.pid" | |
start program = "/etc/init.d/redis-server start" | |
stop program = "/etc/init.d/redis-server stop" |
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
set daemon 30 # check services at 2-minute intervals | |
set logfile /var/log/monit.log | |
set idfile /var/lib/monit/id | |
set statefile /var/lib/monit/state | |
set eventqueue | |
basedir /var/lib/monit/events # set the base directory where events will be stored | |
slots 100 # optionally limit the queue siz | |
set httpd port 2812 | |
allow 0.0.0.0/0.0.0.0 | |
allow username:password |
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
check process redis-server | |
with pidfile "/var/run/redis.pid" | |
start program = "/etc/init.d/redis-server start" | |
stop program = "/etc/init.d/redis-server stop" | |
if 2 restarts within 3 cycles then timeout | |
if totalmem > 100 Mb then alert | |
if children > 255 for 5 cycles then stop | |
if cpu usage > 95% for 3 cycles then restart | |
if failed host 127.0.0.1 port 6379 then restart | |
if 5 restarts within 5 cycles then timeout |
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
// Response | |
try | |
{ | |
using (var response = (HttpWebResponse)httpWReq.GetResponse() as HttpWebResponse) | |
{ | |
if (httpWReq.HaveResponse && response != null) | |
{ | |
using (var reader = new StreamReader(response.GetResponseStream())) { | |
string result = reader.ReadToEnd(); |
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 'spec_helper' | |
describe Api::ElementsController do | |
let!(:user) { FactoryGirl.create(:user) } | |
let(:fire) { FactoryGirl.create(:element, name: "fire") } | |
let(:uber_fire) { FactoryGirl.create(:element, name: "uber fire") } | |
let(:vesuvius) { FactoryGirl.create(:element, name: "vesuvius", parents: [fire, uber_fire, fire]) } | |
let(:kolumbo) { FactoryGirl.create(:element, name: "kolumbo", parents: [fire, uber_fire, fire]) } |
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 Myclass | |
def initialize | |
@attributes = [] | |
end | |
def method_missing(name, *args) | |
attribute = name.to_s | |
if attribute =~ /=$/ | |
@attributes[attribute.chop] = args[0] | |
else |
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
def describe_favorites(*games) | |
games.each do |game| | |
puts "Favorite Game: #{game}" | |
end | |
end | |
describe_favorites(['Mario', 'Contra', 'Metroid']) |
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 Gsadmin | |
module Generators | |
class InitializerGenerator < Rails::Generators::Base | |
source_root File.expand_path("../templates", __FILE__) | |
desc "Gsadmin installation generator." | |
def welcome | |
say "Thank you for using gsadmin, if you have any questions, my email is [email protected]", :cyan | |
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 Baby < RTanque::Bot::Brain | |
NAME = 'baby' | |
include RTanque::Bot::BrainHelper | |
def tick! | |
test_sensors | |
if sensors.position.on_left_wall? | |
command.speed = 3 | |
command.heading = Math::PI | |
command.radar_heading = Math::PI |
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
Gsadmin.config do |config| | |
config.route = "admin" | |
config.devise_model = "admin" | |
end | |