Skip to content

Instantly share code, notes, and snippets.

View rrichardson's full-sized avatar
💭
⚔️ Hacking Away

Rick Richardson rrichardson

💭
⚔️ Hacking Away
View GitHub Profile
fn init_parser() -> *mut h::HParser {
unsafe {
let token1 = h::h_token(hello.as_ptr(), from_uint(hello.char_len()).expect("uint conversion failed"));
let token2 = h::h_token(world.as_ptr(), from_uint(world.char_len()).expect("uint conversion failed"));
let token3 = h::h_token(there.as_ptr(), from_uint(there.char_len()).expect("uint conversion failed"));
let token4 = h::h_token(bang.as_ptr(), from_uint(bang.char_len()).expect("uint conversion failed"));
h::h_sequence(token1, h::h_choice(token2, token3, token4, ptr::null<h::HParser>()) , ptr::null<h::HParser>())
}
}
extern crate libc;
use std::num::{ from_uint };
use std::ptr;
use std::mem;
use std::io::stdio;
use h = hammerll;
static hello : &'static str = "Hello ";
static world : &'static str = "World";
static there : &'static str = "there";
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/resource.h>
#define STACKSIZE (16 * 1024)
#define NUM_THREADS 100000
#define getlimit(x) getrlimit(RLIMIT_##x, &limit); printf("%s current: %lu, max: %lu\n", #x, limit.rlim_cur, limit.rlim_max);
void *do_nothing(void *args)
{
execute pathogen#infect()
" set UTF-8 encoding
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" disable vi compatibility (emulation of old bugs)
set nocompatible
" use indentation of previous line
set autoindent
22:37:31.976 [sparkDriver-akka.actor.default-dispatcher-3] DEBUG o.a.s.s.BlockManagerMasterActor - [actor] handled message (0.072741 ms) ExpireDeadHosts from Actor[akka://sparkDriver/user/BlockManagerMaster#273583151]
22:37:32.376 [sparkDriver-akka.actor.default-dispatcher-13] DEBUG o.a.s.s.c.SparkDeploySchedulerBackend - [actor] received message ReviveOffers from Actor[akka://sparkDriver/user/CoarseGrainedScheduler#-801996212]
22:37:32.377 [sparkDriver-akka.actor.default-dispatcher-13] DEBUG o.a.s.s.c.SparkDeploySchedulerBackend - [actor] handled message (0.327742 ms) ReviveOffers from Actor[akka://sparkDriver/user/CoarseGrainedScheduler#-801996212]
22:37:33.376 [sparkDriver-akka.actor.default-dispatcher-13] DEBUG o.a.s.s.c.SparkDeploySchedulerBackend - [actor] received message ReviveOffers from Actor[akka://sparkDriver/user/CoarseGrainedScheduler#-801996212]
22:37:33.377 [sparkDriver-akka.actor.default-dispatcher-13] DEBUG o.a.s.s.c.SparkDeploySchedulerBackend - [actor] handled message (0.343444 ms) ReviveO
main : Element
main = plotAxis 580 300 "time - minutes" "events"
plotAxis w h xLabel yLabel =
let lineWidth = 2
labelHeight = 10
arrowSize = 6
ylen = toFloat (h-lineWidth-2*arrowSize-4*labelHeight)
xlen = toFloat (w-lineWidth-2*arrowSize-4*labelHeight)
maxX = 100
trait Strategy<Output> {
fn send(&self, item: Result<&Output>);
fn accept(&mut self, sub: &Subscriber<Output>) -> Option<uint>;
}
type Sub<I> = (Subscription, Subscriber<I>);
//This is the most basic strategy which only accepts a single subscriber
struct SingleStrategy<O> {
subscriber: Option<Sub<O>>,
trait Subscriber<Input> {
fn on_subscribe(&self, s: &Subscription);
fn on_next(&self, t: Input);
fn on_error(&self, err: String);
fn on_complete(&self);
}
// how do I explain that Subscriber will outlive O and SingleStrategy as well? e.g. we can almost assume that Subscriber is static, // but not quite.
trait Subscriber<Input> {
...
trait OutputStrategy<'a, Output> {
fn can_continue(&self) -> bool;
fn send(&self, val: Result<Output, &str>);
fn accept(&mut self, sub: &'a Subscriber<Output> +'a) -> Option<uint>;
}
#![feature(globs)]
#![feature(phase)]
extern crate iobuf;
extern crate alloc;
#[phase(plugin, link)]
extern crate log;
#[phase(plugin)]