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 'net/http' | |
module HTTPResponseDecodeContentOverride | |
def initialize(h,c,m) | |
super(h,c,m) | |
@decode_content = true | |
end | |
def body | |
res = super | |
if self['content-length'] && res && res.respond_to?(:bytesize) | |
self['content-length']= res.bytesize |
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
#ruby 1.9.3 | |
require 'bigdecimal' ; require 'bigdecimal/util'; (0.5.to_d / 0.99.to_d).to_f # => 0.505050505 | |
#ruby 2.1.0 | |
require 'bigdecimal' ; require 'bigdecimal/util'; (0.5.to_d / 0.99.to_d).to_f # => 0.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
input { | |
redis { | |
host => "127.0.0.1" | |
data_type => "list" | |
key => "logstash" | |
# We use the 'json' codec here because we expect to read | |
# json events from redis. | |
codec => json | |
} |
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
log_format ftbpro '$http_host ' | |
'$remote_addr [$time_local] ' | |
'"$request" $status $body_bytes_sent ' | |
'"$http_referer" "$http_user_agent" ' | |
'$request_time ' | |
'$upstream_response_time'; |
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
input { | |
file { | |
path => **YOUR NGINX ACCESS LOG FILE PATH** | |
type => "web_nginx_access" | |
} | |
} | |
filter { | |
grok { | |
type => "web_nginx_access" |
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
{ | |
"title": "Nginx Web", | |
"services": { | |
"query": { | |
"list": { | |
"0": { | |
"query": "response:[200 TO 299]", | |
"alias": "OK", | |
"color": "#7EB26D", | |
"id": 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 BankAccount | |
def initialize(balance) | |
@balance = balance | |
end | |
#attr_reader and its equivalent | |
attr_reader :balance | |
def balance | |
@balance | |
end | |
#attr_writer and its equivalent |
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 temporary_balance_boost | |
old_balance = balance | |
balance = balance * 2 | |
puts "Your balance is now #{balance}, you have 10 seconds to use it!" | |
sleep 10 | |
balance = old_balance | |
end | |
def temporary_balance_boost | |
old_balance = @balance |
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
#pipelines {display: none;} | |
#main-panel {width: 100%;} |
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 temporary_balance_boost | |
old_balance = self.balance | |
self.balance = self.balance * 2 | |
puts "Your balance is now #{balance}, you have 10 seconds to use it!" | |
sleep 10 | |
self.balance = old_balance | |
end |
OlderNewer