Skip to content

Instantly share code, notes, and snippets.

@mbrubeck
mbrubeck / current.rs
Last active April 2, 2018 17:00
Rust buffered I/O convenience functions idea
use std::io::{BufReader, BufWriter};
use std::fs::File;
let src = BufReader::new(File::open("input.txt"))?;
let dst = BufWriter::new(File::create("output.txt"))?;
@mbrubeck
mbrubeck / ssh2-sample.rs
Created February 21, 2018 22:27 — forked from opensourcegeek/ssh2-sample.rs
Failing code
extern crate ssh2;
use std::net::TcpStream;
use ssh2::Session;
fn create_session() -> (TcpStream, Session) {
let tcp = TcpStream::connect("test:22").expect("Cannot connect");
let mut sess = Session::new().expect("cannot start session");
sess.handshake(&tcp).expect("handshake failed");
This file has been truncated, but you can view the full file.
--- powi.txt 2018-02-15 10:00:35.322876392 -0800
+++ powf.txt 2018-02-15 10:00:51.822900588 -0800
@@ -171,13 +171,13 @@
22528399544939170000000000000000000.0,
67585198634817530000000000000000000.0,
202755595904452570000000000000000000.0,
- 608266787713357700000000000000000000.0,
+ 608266787713357740000000000000000000.0,
1824800363140073200000000000000000000.0,
5474401089420219000000000000000000000.0,
<table>
<tr>
<td></td>
<td rowspan=3></td>
<td rowspan=2></td>
</tr>
<tr> incoming_rowspan: [0, 2, 1]
<td></td>
</tr>
<tr> incoming_rospwan: [0, 1, 0]
extern crate unicode_segmentation;
use unicode_segmentation::UnicodeSegmentation;
fn main() {
let namaste = "नमस्ते";
println!("{}", namaste);
let etsaman = namaste.graphemes(true).rev().collect::<String>();
println!("{}", etsaman);
}
actors
asciiutils
autoimpl
basichll
bloomfilter
cargotest
concurrenthashmap
corefoundationsys
coremidi
coremidisys
@mbrubeck
mbrubeck / parallel-layout.md
Created September 22, 2017 23:48
Parallel layout in Gecko

Parallel Layout in Gecko

Now that Gecko uses Servo's parallel style system, we want to work outward from there. The next phase could be parallel frame construction, and after that, parallel layout using Servo layout code.

Dividing work between Gecko and Servo

We want to ship this work incrementally (every six weeks), without needing to replace the entire layout system at once. There are a few ways we can convert

inside: TreeIterator { current: Tree { nodes: [None, None] }, depth: 0 }
Got out Tree { nodes: [None, None] }
After first inc(0) Tree { nodes: [None, None] }
After second inc(1) Tree { nodes: [Some(Tree { nodes: [None, None] }), None] }
next tree: Some(Tree { nodes: [None, None] })
inside: TreeIterator { current: Tree { nodes: [Some(Tree { nodes: [None, None] }), None] }, depth: 1 }
Got out Tree { nodes: [Some(Tree { nodes: [None, None] }), Some(Tree { nodes: [None, None] })] }
After first inc(1) Tree { nodes: [Some(Tree { nodes: [None, None] }), Some(Tree { nodes: [None, None] })] }
next tree: Some(Tree { nodes: [Some(Tree { nodes: [None, None] }), Some(Tree { nodes: [None, None] })] })
inside: TreeIterator { current: Tree { nodes: [Some(Tree { nodes: [None, None] }), Some(Tree { nodes: [None, None] })] }, depth: 1 }
#![no_std]
#![feature(alloc_system, lang_items)]
extern crate alloc_system;
pub fn foo() -> u32 {
42
}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] extern fn panic_fmt() -> ! { loop {} }
#![feature(const_fn)]
// rust self-tracing benchmark using DebugCtl.BTF
extern crate winapi;
extern crate kernel32;
extern crate libc;
use std::time::Instant;