Skip to content

Instantly share code, notes, and snippets.

View pythonesque's full-sized avatar

Joshua Yanovski pythonesque

  • Lanetix
  • San Francisco, CA
View GitHub Profile
#![feature(unsafe_destructor)]
use rooted::{RcSend, Root};
use std::fmt;
use std::rc::Rc;
mod rooted {
use std::collections::trie_map::{mod, TrieMap};
use std::fmt;
use std::kinds::marker;
#![feature(rustc_private,std_misc)]
extern crate arena;
use arena::TypedArena;
use std::cell::Cell;
use std::collections::hash_map::Entry as h;
use std::collections::HashMap;
use std::default::Default;
use std::fmt;
@pythonesque
pythonesque / main.rs
Created November 25, 2014 07:41 — forked from TheNeikos/main.rs
#![feature(if_let)]
extern crate arena;
use arena::TypedArena;
use std::cell::Cell;
use std::fmt;
type NodeRef<'a, T> = Cell<Option<&'a Node<'a, T>>>;
use std::default::Default;
use std::num::Zero;
use std::slice::MutItems;
pub struct Matrix<T> {
values: Vec<T>,
rows: uint,
columns: uint,
}
#![feature(optin_builtin_traits,unsafe_destructor)]
pub mod recursive_mutex {
#![allow(unstable)]
use std::cell::UnsafeCell;
use std::sync::Semaphore;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::thread::Thread;
import Char
import Dict
import Dict (Dict)
-- import Graphics.Element (..)
-- import Graphics.Input.Field as Field
-- import Graphics.Input (..)
import Html
import Html (..)
import Html.Attributes (..)
import Html.Events (..)
// The code below results in an error message I do not understand.
//
// This code is a Rust port of some F# code. Specifically, this:
//
// https://github.com/ericsink/LSM
//
// The snippet below has been pared down a lot to approximately
// the minimum necessary to retain the confusing error message.
//
// In general, the problem area seems to be the fact that I am
@pythonesque
pythonesque / slurp.rs
Last active August 29, 2015 14:22 — forked from paulp/slurp.rs
use std::ffi::OsStr;
use std::process::Command;
use std::borrow::Cow;
use std::convert::Into;
pub fn exec_slurp<'a>(cmd: &'a str, args: &[&OsStr]) -> Cow<'a, str> {
println!("exec_slurp({}, {:?})", cmd, args);
Command::new(cmd)
.args(args)
@pythonesque
pythonesque / cuckoo
Created June 18, 2015 18:31
Build flags for cuckoo
# Build instructions
# Build initial libraries
cargo build --release
# Build executable as I have been doing.
#HASH = insert hash here \
rustc src/lib.rs --crate-name libcukoo --crate-type bin \
-C target-cpu=native -C prefer-dynamic -C opt-level=3 \
-C metadata=$HASH -C extra-filename=-$HASH --out-dir ./target/release \
@pythonesque
pythonesque / intrusive.rs
Created September 14, 2015 12:00
Safe (?) interface for intrusive structures
#![cfg_attr(test, feature(rustc_private))]
use std::cell::UnsafeCell;
use std::marker::PhantomData;
use std::ops;
struct InvariantLifetime<'id>(
PhantomData<*mut &'id ()>);
impl<'id> InvariantLifetime<'id> {
#[inline]