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 OpenFileDescriptors < Scout::Plugin | |
def build_report | |
report :open_files => `lsof | wc -l` | |
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 MonitoredJob | |
def self.run(command, ping_url) | |
eval(command) | |
self.ping_twice(ping_url) | |
return "SUCCESS" | |
rescue => e | |
Raven.capture_exception(e) | |
return "'#{command}' could not run: #{e.message}\n#{e.backtrace}" | |
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 SimplePlugin < Scout::Plugin | |
def build_report | |
time = Time.new | |
report(:hour => time.hour, :minute => time.min) | |
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
/usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/filter/timespan.rb:35:in `<=': comparison of Fixnum with nil failed (ArgumentError) | |
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/filter/timespan.rb:35:in `filter' | |
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/controller.rb:291:in `filter_request' | |
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/controller.rb:290:in `each' | |
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/controller.rb:290:in `filter_request' | |
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/controller.rb:322:in `run!' | |
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_analyzer/source/log_parser.rb:272:in `handle_request' | |
from /usr/lib/ruby/gems/1.8/gems/request-log-analyzer-1.6.2/bin/../lib/request_log_ |
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 File | |
alias_method :gets_original, :gets | |
# The size of the reads we will use to add to the line buffer. | |
MAX_READ_SIZE=1024*100 | |
# | |
# This method returns the next line of the File. | |
# | |
# It works by moving the file pointer forward +MAX_READ_SIZE+ at a time, | |
# storing seen lines in <tt>@line_buffer</tt>. Once the buffer contains at |
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 raplet | |
html="" | |
email=params[:email] | |
if retrieve_user | |
html=render_to_string :layout=>false | |
end | |
res={:html=>html,:status=>200, :css=>'a{color:blue} ul{padding-left:20px;margin:4px 0;} link{color:blue;cursor:hand}', :js=>"$('.details-link').click(function(){ $('#'+this.id.replace('l','a')).toggle()})"} | |
render :text=>params[:callback]+"("+res.to_json+")" | |
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
NSString *string = @"Lion says:\nRoar!\nGrowl!"; | |
NSMutableString *mstring = [NSMutableString stringWithString:string]; | |
NSLog(@"before: %@",mstring); | |
NSRange wholeShebang = NSMakeRange(0, [mstring length]); | |
[mstring replaceOccurrencesOfString: @"\n" | |
withString: @"" | |
options: 0 | |
range: wholeShebang]; |
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
string = "Lion says:\nRoar!\nGrowl!" | |
string.gsub("\n",'') |
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
NSString *appName = @"Redwood: "; | |
NSString *tagline = @"OSX Spotlight for the cloud."; | |
NSString *message = [appName stringByAppendingString:tagline]; |
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
app_name = "Redwood: " | |
tagline = "OSX Spotlight for the cloud." | |
message = app_name + tagline |
OlderNewer