Skip to content

Instantly share code, notes, and snippets.

Matt Brubeck mbrubeck

Block or report user

Report or block mbrubeck

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Cargo.toml
[package]
name = "pb"
version = "0.1.0"
authors = ["Matt Brubeck <mbrubeck@limpet.net>"]
edition = "2018"
[[bin]]
name = "pb"
path = "main.rs"
View Cargo.toml
[package]
name = "foo"
version = "0.1.0"
authors = ["Matt Brubeck <mbrubeck@limpet.net>"]
edition = "2018"
[dependencies]
[build-dependencies]
smallvec = "0.6"
View lib.rs
#![feature(test)]
extern crate test;
trait Max2 {
type Item;
fn max_by_key2<B: Ord, F>(self, f: F) -> Option<Self::Item> where
Self: Sized,
F: FnMut(&Self::Item) -> B;
}
View xor.rs
use itertools::zip;
use std::ops::{BitXor, BitXorAssign};
pub fn xor<T>(x: &[T], y: &[T]) -> Vec<T>
where T: BitXor<Output=T> + Copy {
zip(x, y).map(|(a, b)| *a ^ *b).collect()
}
pub fn xor_with<T>(x: &mut [T], y: &[T])
where T: BitXorAssign + Copy {
View main.rs
pub fn render(library: &Library, state: &mut State, mut stack: Vec<String>, expression: &mut Expression) -> Expression {
match expression {
// We have a symbolic expression that we have to evaluate
Expression::Symbolic(ref mut args) | Expression::NotDone(ref mut args) => {
// If we have a valid expression (unnamed ones are not allowed)
if args.len() > 0 {
// Get the first nested expression
return match args.remove(0) {
// If the first expression is a plain literal
Expression::Literal(Literal::S(name)) => {
View gist:1a150307805761f61ad00c3eede48267
armv7_unknown_cloudabi_eabihf cortex-a8
i686_apple_darwin yonah
i686_linux_android pentiumpro
i686_pc_windows_gnu pentium4
i686_pc_windows_msvc pentium4
i686_unknown_cloudabi pentium4
i686_unknown_dragonfly pentium4
i686_unknown_freebsd pentium4
i686_unknown_haiku pentium4
i686_unknown_linux_gnu pentium4
View gist:be81f237b50bba35703f031f38bf54cb
$ hg log -r FIREFOX_59_0_2_RELEASE..FIREFOX_59_0_3_RELEASE
changeset: 471206:239e434d6d2b
tag: FENNEC_59_0_2_BUILD1
tag: FENNEC_59_0_2_RELEASE
tag: FIREFOX_59_0_2_BUILD1
tag: FIREFOX_59_0_2_RELEASE
user: Vlad Baicu <vlad.baicu@softvision.ro>
date: Thu Mar 22 13:46:41 2018 -0700
summary: Bug 1444549 - Remove unused IconTabWidget XML attr. r=mcomella, a=RyanVM
@mbrubeck
mbrubeck / current.rs
Last active Apr 2, 2018
Rust buffered I/O convenience functions idea
View current.rs
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"))?;
View ssh2-sample.rs
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");
View powi-powf.diff
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,
You can’t perform that action at this time.