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
var cp = require('child_process'); | |
function *doKill(process, initial_delay) | |
{ | |
yield process.kill('SIGTERM'); | |
yield process.kill('SIGKILL'); | |
} | |
function niceKill(process, onExit, initial_delay) | |
{ |
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 File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) | |
Thread.start(TCPServer.new(51313)) do |server| | |
loop do | |
puts "listening" | |
client = server.accept | |
puts "new client" | |
while line = client.gets |
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 Inspector | |
def inspect_objects_space | |
count = Hash.new(0) | |
ObjectSpace.each_object(Object) {|o| count[o.class] += 1 } | |
server = TCPSocket.new 'localhost', 51313 | |
max = count.reduce do |a, v| a[1] > v[1] ? a : v end | |
server.puts max.to_s | |
server.close | |
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
class SingletonTest | |
def data | |
@data | |
end | |
def data=(n) | |
@data = n | |
end | |
@old_new_method = self.method(: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
require 'git' | |
require 'fileutils' | |
require 'yaml' | |
class Key < ActiveRecord::Base | |
def self.authorized_keys_content | |
Key.all.each.reduce('') do |ac, key| | |
ac << "#{key.public_key}\n" | |
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
require 'packetfu' | |
include PacketFu | |
iface = ARGV[0] || "en1" | |
def sniff(iface) | |
cap = Capture.new(:iface => iface, :start => true) | |
cap.stream.each do |p| | |
pkt = Packet.parse p | |
if pkt.is_tcp? |
NewerOlder