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
pub struct Destructed<'a, T> {
fun: Box<for <'b> FnOnce<(&'b T,), ()> + 'a>,
active: bool,
val: T
}
impl<'a, T> Destructed<'a, T> {
pub fn new(val: T, f: Box<for <'b> FnOnce<(&'b T,), ()> + 'a>) -> Destructed<'a, T> {
Destructed { val: val, fun: f, active: true }
}
#![feature(globs)]
#![feature(phase)]
extern crate iobuf;
extern crate alloc;
#[phase(plugin, link)]
extern crate log;
#[phase(plugin)]
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>;
}
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 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>>,
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
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
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
#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)
{
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";