Skip to content

Instantly share code, notes, and snippets.

View macournoyer's full-sized avatar

Marc-André Cournoyer macournoyer

View GitHub Profile
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xc0000007
0x00183463 in st_lookup (table=0x458c810, key=2889, value=0xbffe8d8c) at st.c:250
250 hash_val = do_hash(key, table);
(gdb) bt
#0 0x00183463 in st_lookup (table=0x458c810, key=2889, value=0xbffe8d8c) at st.c:250
#1 0x001939fe in classname (klass=52968440) at variable.c:151
#2 0x00193f2f in rb_class_path (klass=52968440) at variable.c:190
#3 0x00194091 in rb_class2name (klass=3221225475) at variable.c:301
#4 0x001129fa in rb_check_type (x=52968500, t=34) at error.c:276
diff --git a/vm/gc.c b/vm/gc.c
index baec8c5..88a462d 100644
--- a/vm/gc.c
+++ b/vm/gc.c
@@ -1,17 +1,17 @@
#include "tr.h"
-OBJ GC_alloc(void* type){
- OBJ data = calloc(1, sizeof(type));
+OBJ GC_alloc(int size){
# Rack middleware to concatenate and serve sprocket files
# Usage:
#
# use Rack::Sprockets, :path => "/all.js", # URL to serve
# :load_path => ["src"], # Sprockets Secretary options
# :source_files => ["src/my_lib.js"]
#
require "sprockets"
module Rack
class PusherWare
def initialize(app)
@app = app
@pusher = Pusher::App.new
end
def call(env)
if env["PATH_INFO"] ~= /\/pusher/
@pusher.call(env)
else
# Lighter -- Campfire from the command line
# usage: ruby lighter.rb subdomain "Main Room" macournoyer@gmail
require "rubygems"
require "tinder"
require "readline"
require "highline/import"
class Lighter
def initialize(room)
@room = room
#!/usr/bin/env ruby
domain, room, *message = ARGV
token = File.read(ENV['HOME'] + '/.talker').strip
abort <<-TEXT unless domain && room && token
Usage: #{File.basename($0)} domain room_id [message]
Reads from stdin if no message supplied
Expects a user token in $HOME/.talker
TEXT
@macournoyer
macournoyer / ghi.rb
Created December 7, 2009 21:20
CLI for github issues WITH COLORS!
#!/usr/bin/env ruby
require "rubygems"
require "mutter"
require "httparty"
REMOTE = "origin"
REPO = `git config --get remote.#{REMOTE}.url`.chomp[/github\.com[\/\:]([^\/]+\/[^\/]+)\.git/, 1]
USER = `git config --get github.user`.chomp
TOKEN = `git config --get github.token`.chomp
require "talker"
module Connection
attr_accessor :client
def data_received(data)
client.send_message data
end
end
// compile: gcc 0L.c
// example:
// ./a.out 00201320130
// expanded:
// ./a.out \
// 002 # LOAD R[0] = 2 \
// 013 # LOAD R[1] = 3 \
// 201 # ADD R[0] += R[1] \
// 30 # PRINT R[0]
// should print: 5
# In your .gitconfig
[alias]
ptp = !git pull && rake && git push
push-retry = !git push || git ptp