Skip to content

Instantly share code, notes, and snippets.

@careo
careo / stats.rb
Created October 8, 2009 06:23 — forked from tmm1/stats.rb
require 'socket'
require 'rubygems'
require 'collectd/pkt'
class Stats
def initialize name, instance, opts = {}
@name, @instance = name, instance
@sock = UDPSocket.new
@sock.connect opts[:host] || '239.192.74.66',
ruby-prof
=========
Thread ID: 2148364720
Total: 71.501190
%self total self wait child calls name
22.00 15.73 15.73 0.00 0.00 421 OpenSSL::SSL::SSLSocket#sysread
10.82 7.77 7.74 0.03 0.00 194 IO#sysread
4.92 3.52 3.52 0.00 0.00 21 OpenSSL::SSL::SSLSocket#connect
# NOTE 1: to use, you'll also need to place something like this in your precmd function:
# findrvm $PWD
#
# NOTE 2: It won't restore your rvm setting when you leave the directory. the function
# stops at the first .rvm it finds, so if you really want to always use a default ruby
# unless you tell it otherwise, put a .rvm somewhere outside all your projects.
#
# NOTE 3: also, for this to work in zsh you need the latest rvm from git that exports
# $rvm_ruby_string and $rvm_gem_set_name
#
@careo
careo / my.cnf
Created November 17, 2009 17:37
[mysqld]
query_cache_size=1000000
innodb_file_per_table
innodb_buffer_pool_size=83886080
innodb_flush_log_at_trx_commit=0
ruby-1.8.7-p174 > localhost = Socket.getaddrinfo("127.0.0.1", nil)[0][2]
=> "rightscale.local"
ruby-1.8.7-p174 > addresses = Resolv.getaddresses(localhost)
=> []
...
ruby-1.8.7-p174 > Resolv.getaddresses('odin')
=> ["192.168.1.143"]
ruby-1.8.7-p174 > Resolv.getaddresses('odin.local')
@careo
careo / asm.m
Created November 26, 2009 06:14
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSLog(@"Hello, World!");
[pool drain];
return 0;
}
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[]) {
__block int i = 0;
void (^tick)(void) = ^{
i++;
NSLog(@"Tick: %d", i);
};
#include <CoreServices/CoreServices.h>
static void mycallback(ConstFSEventStreamRef streamRef, void *clientCallBackInfo, size_t numEvents, void *eventPaths,
const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]) {
int i;
char **paths = eventPaths;
for (i=0; i<numEvents; i++) {
/* flags are unsigned long, IDs are uint64_t */
printf("Change %llu in %s, flags %lu\n", eventIds[i], paths[i], eventFlags[i]);
└─(1::01:01:%)── MAGLEV_OPTS="-d -MtraceLoad" maglev-gem install sinatra ──(Thu,Dec03)─┘
_____________________________________________________________________________
| Configuration Files |
| |
| System File: /Users/djensen/Source/Ruby/maglev/etc/system.conf |
| |
| Executable File: /Users/djensen/gem.conf |
| Warning: File not found (errno=2,ENOENT, The file or directory specified cannot
| be found) |
| using defaults. |
ERL_LIBS=/Library/Erlang/lib
if [ -d $HOME/Library/Erlang/lib ]; then
ERL_LIBS=$HOME/Library/Erlang/lib:$ERL_LIBS
fi
export ERL_LIBS
export CAPP_BUILD=$HOME/Library/JavaScript/Cappuccino
export JAVA_HOME=$(/usr/libexec/java_home)