Skip to content

Instantly share code, notes, and snippets.

Will Crichton willcrichton

Block or report user

Report or block willcrichton

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 query.js
var videos = [{frames: [1,2,3]},{frames: [1,2,3]},{frames: [1,2,3]}]
var detectFaceBoundingBoxes = function(frame) {
return flip(.5) ? [.7] : (flip(.5) ? [.7, .8] : (flip(.5) ? [.7, .8, .9] : [.7, .8, .9, .7]))
}
var predictGender = function(boundingBox, frame) {
return flip(.7) ? .9 : .1
}
var isWolfBlitzer = function(boundingBox, frame) {
return flip(.7) ? .8 : .2
}
View auto_into.rs
#![feature(proc_macro)]
extern crate proc_macro;
extern crate proc_macro2;
extern crate syn;
#[macro_use]
extern crate quote;
use proc_macro2::{Span};
View gist:ec8a0f6ada3caaeda1d0
let mut tmp = os::tmpdir();
tmp.push(Path::new("llvm_tmp"));
File::create(&tmp).write_str(gen.as_slice()).unwrap();
match Command::new(format!("llvm-as < {} | opt | llvm-dis", tmp.display())).output() {
Ok(out) => out.output.to_string(),
Err(e) => fail!("Fail? {}", e)
}
View gist:3e89f92ceec1db084b1a
/Users/will/Code/git/gpe/src/compress.rs:72:33: 72:37 error: cannot infer an appropriate lifetime due to conflicting requirements
/Users/will/Code/git/gpe/src/compress.rs:72 let self_ref = Arc::new(self);
^~~~
/Users/will/Code/git/gpe/src/compress.rs:55:66: 91:6 note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the block at 55:65...
/Users/will/Code/git/gpe/src/compress.rs:55 fn mutate(&self, population: Vec<Encoding>) -> Vec<Encoding> {
/Users/will/Code/git/gpe/src/compress.rs:56 let mut new_population = Vec::new();
/Users/will/Code/git/gpe/src/compress.rs:57 for candidate in population.into_iter() {
/Users/will/Code/git/gpe/src/compress.rs:58 for _ in range(0, constants::MUTATIONS) {
/Users/will/Code/git/gpe/src/compress.rs:59 new_population.push(Some(candidate.clone()));
/Users/will/Code/git/gpe/src/compress.rs:60 }
View gist:2537feaa54b55b8c7c6d
MOVL %r15d,8(%rsp)
MOVQ 8(%rsp),%rax
ADDQ %rsi,%rax
MOVQ 0(%rax),%rax
View gist:3c78d92a1a97d0baa630
[root]
name = "gpe"
version = "0.0.1"
dependencies = [
"graphics 0.0.0 (git+https://github.com/PistonDevelopers/graphics)",
"image 0.1.0 (git+https://github.com/PistonDevelopers/rust-image)",
"opengl_graphics 0.0.0 (git+https://github.com/pistondevelopers/opengl_graphics)",
"sdl2_window 0.0.0 (git+https://github.com/pistondevelopers/sdl2_window)",
]
View gist:b83dd6b2056a096c2fe8
Compiling gpe v0.0.1 (file:///Users/will/Code/git/gpe)
warning: using multiple versions of crate `image`
/Users/will/Code/git/gpe/src/main.rs:4:1: 4:20 note: used here
/Users/will/Code/git/gpe/src/main.rs:4 extern crate image;
^~~~~~~~~~~~~~~~~~~
note: crate name: image
/Users/will/Code/git/gpe/src/render.rs:5:1: 5:30 note: used here
/Users/will/Code/git/gpe/src/render.rs:5 extern crate opengl_graphics;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
View gist:4da15e7b44277996dea8
[package]
name = "gpe"
version = "0.0.1"
authors = ["Will Crichton <willcrichton@cmu.edu>"]
[dependencies.image]
git = "https://github.com/PistonDevelopers/rust-image"
@willcrichton
willcrichton / tree.c
Created Jan 14, 2013
Binary search trees (Coding for Interviews)
View tree.c
/*
* Question 1: The three main depth-first traversals are:
* preorder: visiting the root, then left and right subtree,
* inorder: visiting the left subtree, then root, then right subtree
* postorder: visiting the left and right subtree, then the root
*
* In implementing any of these, you just want to make sure you hit
* every node and that you don't try to visit NULL nodes
*/
You can’t perform that action at this time.