Skip to content

Instantly share code, notes, and snippets.

View tmm1's full-sized avatar

Aman Gupta Karmani tmm1

View GitHub Profile
@tmm1
tmm1 / em-rpc-server.rb
Created April 16, 2009 21:49
simple EM rpc server
require 'rubygems'
require 'eventmachine'
require 'socket'
module RPCServer
include EM::P::ObjectProtocol
def post_init
@obj = Hash.new
end
def receive_object method
~/projects/jruby ➔ jruby -J-Xrunjdwp:transport=dt_socket,server=y,address=12345,suspend=n object_walker_test.rb
Listening for transport dt_socket at address: 12345
found object: I am Foo #0
found object: I am Foo #1
found object: I am Foo #2
found object: I am Foo #3
found object: I am Foo #4
found object: I am Foo #5
found object: I am Foo #6
found object: I am Foo #7
@tmm1
tmm1 / gist:329682
Created March 11, 2010 21:31
EM Chat Server Demo
require 'rubygems'
require 'eventmachine'
require 'em-http' # gem install em-http-request
require 'yajl' # gem install yajl-ruby
class String
def bold
"\033[1m#{self}\033[0m"
end
end
diff --git a/src/org/jruby/RubyBasicObject.java b/src/org/jruby/RubyBasicObject.java
index 86a0123..6a36d33 100644
--- a/src/org/jruby/RubyBasicObject.java
+++ b/src/org/jruby/RubyBasicObject.java
@@ -29,8 +29,12 @@ package org.jruby;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
@rtomayko
rtomayko / unicorn_github
Created May 17, 2010 19:56
GitHub RailsBench GC settings
#!/bin/sh
# Usage: unicorn_github
# Script used to start unicorn in GitHub staging and production environments.
# This is called primarily by god.
set -e
# configure GC settings
export RUBY_HEAP_MIN_SLOTS=800000
export RUBY_HEAP_FREE_MIN=100000
export RUBY_HEAP_SLOTS_INCREMENT=300000
@tmm1
tmm1 / bench.rb
Created June 30, 2010 03:12
performance improvements for Bundler and Gem::Version#<=>
require 'rubygems'
# diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb
# index 50d8204..4962ce1 100644
# --- a/lib/rubygems/version.rb
# +++ b/lib/rubygems/version.rb
# @@ -295,12 +295,16 @@ class Gem::Version
# rhsize = other.segments.size
# limit = (lhsize > rhsize ? lhsize : rhsize) - 1
#
// Copyright 2009 Ryan Dahl <ry@tinyclouds.org>
#include <node_events.h>
#include <node.h>
namespace node {
using namespace v8;
// EventSource

Hello How are you today, I hope all is well with you .I am sorry to worry you with my proposal for a relationship with you, but I know that you will grant my request in good faith and understanding, My name is Tessy I just went through your profile today at (github.com) and i have no options than letting you know that i am interested in having a relationship with you, I will also like to Know you the more, you can send an email to my email address so that I can send you more details about my self including my picture. I believe we can move from here. But bear in mind that love has no colors barrier, no educational back ground barrier, no socio-economic barrier, religious, language, nationality or distance barrier, the only important thing there is love. I am waiting for your mail to my email address above. Yours sincerely.

Tessy,

# object_walker.rb
require 'java'
require 'jruby/util'
module ObjectWalker
import com.sun.jdi.Bootstrap
# Generate a histogram of all classes in the system
def self.histogram
classes = VM.all_classes
@tmm1
tmm1 / gist:504342
Created August 2, 2010 08:37
rails3 patch for perftools.rb cpu/object profiling
diff --git a/Gemfile b/Gemfile
index fd90d42..9dd0146 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,4 +1,6 @@
source 'http://rubygems.org'
+gem 'perftools.rb', '>= 0.4.4'
+gem 'rack-perftools_profiler'
gem 'rails', '3.0.0.rc'