This file contains hidden or 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 'time' | |
require 'active_support/core_ext/string' | |
class ForeignKey | |
end | |
FOREIGN_KEY = ForeignKey.new |
This file contains hidden or 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
<html> | |
<head> | |
<title>latency!</title> | |
<style type = "text/css"> | |
body { font-family: "Helvetica Neue"; font-size: 0.8em; font-weight: 300; } | |
#chart rect { stroke: #000; fill: #084c7d; } | |
text { fill: #000; } | |
</style> | |
<script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script src = "https://raw.github.com/mbostock/d3/master/d3.v2.min.js"></script> |
This file contains hidden or 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 'eventmachine' | |
require 'eventmachine-tail' | |
class LogHandler < EventMachine::FileTail | |
def initialize(path, startpos = -1, *args) | |
super path, startpos | |
p args |
This file contains hidden or 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
alternatives --install /usr/bin/java java /usr/java/jre1.6.0_31/bin/java 2 \ | |
--slave /usr/bin/keytool keytool /usr/java/jre1.6.0_31/bin/keytool \ | |
--slave /usr/bin/orbd orbd /usr/java/jre1.6.0_31/bin/orbd \ | |
--slave /usr/bin/pack200 pack200 /usr/java/jre1.6.0_31/bin/pack200 \ | |
--slave /usr/bin/rmid rmid /usr/java/jre1.6.0_31/bin/rmid \ | |
--slave /usr/bin/rmiregistry rmiregistry /usr/java/jre1.6.0_31/bin/rmiregistry \ | |
--slave /usr/bin/servertool servertool /usr/java/jre1.6.0_31/bin/servertool \ | |
--slave /usr/bin/tnameserv tnameserv /usr/java/jre1.6.0_31/bin/tnameserv \ | |
--slave /usr/bin/unpack200 unpack200 /usr/java/jre1.6.0_31/bin/unpack200 \ | |
--slave /usr/lib/jvm/jre jre /usr/java/jre1.6.0_31 \ |
This file contains hidden or 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://host.com/path?query=1234 | |
get '/path' do | |
# params['query'] will contain '1234' | |
end | |
# http://host.com/path/1234 | |
get '/path/:number' do | |
# params['number'] will contain '1234' | |
end |
This file contains hidden or 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 | |
line = "The quick brown fox jumped over the lazy dog" | |
r = { | |
:cat => /cat/, | |
:rabbit => /rabbit/, | |
:horse => /horse/, | |
:dog => /(\w+)\s+dog/ | |
} |
This file contains hidden or 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 java.net.*; | |
class McastReceiver { | |
final static String DEFAULT_MCAST_GROUP = "224.56.78.90"; | |
final static int DEFAULT_MCAST_PORT = 12345; | |
final static String JOIN_MSG = "hello!"; | |
MulticastSocket m_McastSock; | |
InetAddress m_Addr; | |
int m_Port; |
This file contains hidden or 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 'sinatra' | |
require 'json' | |
require 'active_support/core_ext/object' | |
require 'pony' | |
FROM_ADDRESS = '[email protected]' |
This file contains hidden or 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 AddIndexesToAlertsTable < ActiveRecord::Migration | |
def self.up | |
add_index :alerts, [ :signature ] | |
end | |
def self.down | |
remove_index :alerts, [ :signature ] | |
end | |
end |
This file contains hidden or 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 'snmp' | |
require 'time' | |
def mbps(bytes, duration) | |
((bytes / duration) * 8.to_f) / 1000000 | |
end |