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/bin/ruby | |
# /usr/bin/escapepath utility: escape spaces on file names. | |
require 'shellwords' | |
puts(STDIN.gets.chomp.shellescape) while not STDIN.eof? |
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 'singleton' | |
set_trace_func proc { |event, file, line, id, binding, classname| | |
if event == "line" && file == "Programator2000" | |
puts Programator2000.instance.to_lines[line - 1] | |
print "[NEXT]" | |
gets | |
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
# Taken from passenger_memory_stats script | |
# Returns the private dirty RSS for the given process, in KB. | |
def determine_private_dirty_rss(pid) | |
total = 0 | |
File.read("/proc/#{pid}/smaps").split("\n").each do |line| | |
line =~ /^(Private)_Dirty: +(\d+)/ | |
if $2 | |
total += $2.to_i | |
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
# rack-httperflog | |
# httperf wsesslog generator middleware. | |
# http://github.com/EmmanuelOga/rack-httperflog/ | |
require "net/http" | |
require "nokogiri" | |
require "rack" | |
module Rack | |
class Httperflog < Struct.new(:app, :ping_urls, :log_path, :flag_path) | |
def call(env) |
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 "rubygems" | |
require "uri" | |
require "yajl/http_stream" | |
require 'shellwords' | |
require 'open-uri' | |
require 'term/ansicolor' | |
$domain = "broadspire" | |
$token = '90454e67ebe1e202034a49266cc0abf0de7e538e' | |
$room_id = 177718 |
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.1p243 (2009-07-16 revision 24175) [x86_64-linux] | |
curb (0.6.2.1) | |
em-http-request (0.2.5) | |
eventmachine (0.12.10) | |
typhoeus (0.1.13) | |
user system total real Memory (Kb) | |
4kb std | |
0.000000 0.000000 3.010000 ( 22.408594) 24,484 |
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 Model < AR::Base | |
named_scope :my_grandma, lambda { blah! } | |
belongs_to :something | |
CONSTANT = "K" | |
attr_wicked :column | |
attr_accessible :col2 | |
attr_protected :col3 |
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
# Use with ree. | |
# http://blog.evanweaver.com/articles/2009/10/21/object-allocations-on-the-web/ | |
GC.enable_stats | |
def sizeof(obj) | |
GC.clear_stats | |
obj.clone | |
puts "#{GC.num_allocations} allocations" | |
GC.clear_stats | |
obj.clone | |
puts "#{GC.allocated_size} bytes" |
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
# This is crap. :o | |
# Why did I code this? I should have know better. | |
# only in ruby 1.9 | |
class Stringificator < BasicObject | |
Signature = " > a hidden method < " | |
define_method(Signature) { ::Kernel.binding } | |
def method_missing(x) | |
x.to_s |
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
#include <cairo/cairo.h> | |
int | |
main (int argc, char *argv[]) | |
{ | |
cairo_surface_t *surface = | |
cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 240, 80); | |
cairo_t *cr = | |
cairo_create (surface); |
OlderNewer