Skip to content

Instantly share code, notes, and snippets.

View schmurfy's full-sized avatar
:octocat:

Julien Ammous schmurfy

:octocat:
View GitHub Profile
@schmurfy
schmurfy / check_lua.c
Created November 20, 2010 16:23
check_lua.c
#include <dlfcn.h>
#include <stdio.h>
int main (int argc, char const *argv[])
{
void *module;
printf("started\n");
module = dlopen("/Users/schmurfy/Dev/personal/collectd/test_install/lib/collectd/lua.so", RTLD_NOW);
if( module == NULL ){
@schmurfy
schmurfy / case1.lua
Created November 28, 2010 15:04
LUA collectd examples
-- (implemntation ~ 100 lines of C code)
-- first way
function my_callback1()
dispatch_values(...)
end
function my_callback2()
dispatch_values(...)
dispatch_values(...)
end
require 'rubygems'
gem 'eventmachine', '>= 0.12.10'
gem 'activerecord', '~> 3.0.3'
gem 'mysql2', '~> 0.2.6'
require 'eventmachine'
require 'active_record'
$> ruby async_ar.rb
started
An exception occurred running async_ar.rb
StackError (StackError)
Backtrace:
String#[] at kernel/common/string.rb:239
Regexp::SourceParser#push_current_character! at kernel/common/regexp.rb:453
Regexp::SourceParser#process_until_group_finished at kernel/common/regexp.rb:447
Regexp::SourceParser#process_until_group_finished at kernel/common/regexp.rb:448 (30 times)
require 'rubygems'
$LOAD_PATH << File.expand_path('../../lib', __FILE__)
require 'em-zeromq'
Thread.abort_on_exception = true
class EMTestPullHandler
attr_reader :received
def on_readable(socket, messages)
messages.each do |m|
@schmurfy
schmurfy / traces
Created March 17, 2011 14:34
trace_1
0x003eeb50 in rb_stack_trace (result=0xbffde708, max_depth=300) at perftools.c:99
99 if (frame->prev && frame->prev->last_func) {
(gdb) bt
#0 0x003eeb50 in rb_stack_trace (result=0xbffde708, max_depth=300) at perftools.c:99
#1 0x003ef5ee in CpuProfiler::prof_handler (sig=27, signal_ucontext=0xbffdec9c, cpu_profiler=0x3fa520) at src/profiler.cc:290
#2 0x003f0a52 in ProfileHandler::SignalHandler (sig=27, sinfo=0xbffdec1c, ucontext=0xbffdec9c) at src/profile-handler.cc:455
#3 <signal handler called>
#4 0x00385fa2 in ?? () from /lib/libc.so.6
#5 0x00158e3f in rb_thread_restore_context_0 (th=0x8ac7018, exit=1) at /usr/include/bits/string3.h:52
#6 0x00159c5b in stack_extend (th=0x959d434, exit=-1073859840) at eval.c:10839
@schmurfy
schmurfy / traces
Created March 17, 2011 14:39
trace2
Program received signal SIGSEGV, Segmentation fault.
classname (klass=4) at variable.c:150
150 if (ROBJECT(klass)->iv_tbl) {
(gdb) bt
#0 classname (klass=4) at variable.c:150
#1 0x001dd5f4 in rb_class_path (klass=4) at variable.c:190
#2 0x001dd775 in rb_class_name (klass=4) at variable.c:294
#3 0x001dd79d in rb_class2name (klass=4) at variable.c:301
#4 0x003f1e87 in ProfileData::Stop (this=0x3fa524) at src/profiledata.cc:268
#5 0x003ef1fe in CpuProfiler::Stop (this=0x3fa520) at src/profiler.cc:212
Protected Class App
Inherits Application
Sub Open()
Dim s As New MySocket
s.Address = "127.0.0.1"
s.Port = 4000
s.Connect()
##
# Class documentation
#
# @example
# obj = MyClass.new
# obj.do_something_awesome()
#
class MyClass
end
@schmurfy
schmurfy / gist:944167
Created April 27, 2011 12:30
rvm_error
$ rvm -v
rvm 1.6.4 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
$ sudo rvm install 1.8.7-p334
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.8.7-p334, this may take a while depending on your cpu(s)...
ruby-1.8.7-p334 - #fetching
ruby-1.8.7-p334 - #extracting ruby-1.8.7-p334 to /usr/local/rvm/src/ruby-1.8.7-p334
ERROR: Error running 'bunzip2 < '/usr/local/rvm/archives/ruby-1.8.7-p334.tar.bz2' | tar xf --no-same-owner - -C /usr/local/rvm/tmp/rvm_src_10220', please read /usr/local/rvm/log/ruby-1.8.7-p334/extract.log
ERROR: There has been an error while trying to extract the source.
Halting the installation.