Skip to content

Instantly share code, notes, and snippets.

View cjameshuff's full-sized avatar

Christopher James Huff cjameshuff

View GitHub Profile
{bLength: (uint8_t)18,
bDescriptorType: (uint8_t)1,
bcdUSB: (uint16_t)512,
bDeviceClass: (uint8_t)255,
bDeviceSubClass: (uint8_t)254,
bDeviceProtocol: (uint8_t)0,
bMaxPacketSize0: (uint8_t)64,
idVendor: (uint16_t)8137,
idProduct: (uint16_t)3,
bcdDevice: (uint16_t)256,
class Pry
retrieve_line = self.instance_method(:retrieve_line)
define_method(:retrieve_line) do |eval_string, target|
puts "*"
retrieve_line.bind(self).call(eval_string, target)
end
end
t = Thread.new {10.times {|x| puts x; sleep 1}}
while buf = Readline.readline
p buf
if(buf == 'q')
break
end
end
require 'inline'
class BetterReadline
inline :C do |builder|
builder.include '<ruby.h>'
builder.include '<readline/readline.h>'
src = <<END
VALUE readline_intern(void * data) {
char ** rstr = (char **)data;
*rstr = readline(NULL);
return Qnil;
class ThreadmappedObject
def initialize(prototype, delegates = {})
@delegates = delegates
prototype.methods.each {|m|
(class << self; self; end).class_eval {
define_method(m) {|*args, &block|
deleg = @delegates.fetch(Thread.current) {@delegates[:default]}
if(deleg)
deleg.send(m, *args, &block)
else
// g++ minimal.cpp -o minimal `pkg-config --cflags --libs gtk+-3.0`
#include <gtk/gtk.h>
int main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
GtkWidget * window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_widget_show(window);
gtk_main();
return 0;
2012-08-24 16:57:24.349 minimal[46878:903] -[NSEvent hasPreciseScrollingDeltas]: unrecognized selector sent to instance 0x101560b20
2012-08-24 16:57:24.351 minimal[46878:903] An uncaught exception was raised
2012-08-24 16:57:24.352 minimal[46878:903] -[NSEvent hasPreciseScrollingDeltas]: unrecognized selector sent to instance 0x101560b20
2012-08-24 16:57:24.353 minimal[46878:903] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSEvent hasPreciseScrollingDeltas]: unrecognized selector sent to instance 0x101560b20'
*** Call stack at first throw:
(
0 CoreFoundation 0x00007fff81f64784 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x00007fff80327f03 objc_exception_throw + 45
2 CoreFoundation 0x00007fff81fbe110 +[NSObject(NSObject) doesNotRecognizeSelector:] + 0
3 CoreFoundation 0x00007fff81f368ef ___forwarding___ + 751
struct Body {
body_id_t id;
double mass;
vec2 pos, tmp_pos;
vec2 vel, tmp_vel;
vec2 accel, prev_accel;
vec2 kv1, kv2, kv3, kv4;
vec2 kp1, kp2, kp3, kp4;
def open_data_file(fname)
puts "reading #{fname}"
fin = File.open(fname, "r")
line_iter = fin.lines("\r")
line_iter.each {|line|
# puts "@"
# puts line.chomp
; ModuleID = 'bc/main.cpp.bc'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.6.0"
@str = private unnamed_addr constant [28 x i8] c"Plugin Initialize() called!\00"
define i32 @Initialize(i32 %argc, i8** nocapture %argv) nounwind uwtable ssp {
entry:
tail call void @llvm.dbg.value(metadata !{i32 %argc}, i64 0, metadata !15), !dbg !17
tail call void @llvm.dbg.value(metadata !{i8** %argv}, i64 0, metadata !16), !dbg !17