Skip to content

Instantly share code, notes, and snippets.

Dr-Emann /
Created Oct 30, 2018 — forked from rust-play/
Code shared from the Rust Playground
use std::sync::{Arc, Mutex, MutexGuard};
use std::thread;
use std::thread::JoinHandle;
type SafeNode = Arc<Mutex<TreeNode>>;
struct TreeNode {
value: u16,
children: Vec<TreeNode>,
Dr-Emann /
Created Apr 27, 2017 — forked from anonymous/
Rust code shared from the playground
extern crate rand;
use rand::{thread_rng, Rng};
use rand::distributions::{Normal, IndependentSample};
struct SinglePack {
open_block: Vec<f64>,
open_sum: f64,
blocks: Vec<Vec<f64>>,
Dr-Emann /
Last active Sep 12, 2016 — forked from jackmott/
Naive Rust Game
// Implementation contributed by
// Optimized game implementation in Rust
extern crate time;
use time::precise_time_ns;
use std::ops::{Add, Sub, Mul};
const NUM_BLOCKS: usize = 65535;
const NUM_ENTITIES: usize = 1000;
const CHUNK_COUNT: usize = 100;
Dr-Emann /
Created Oct 1, 2015 — forked from pnispel/
bad rust?
let start = time::now();
let metadata = try!(fs::metadata(&path));
let mut file = try!(File::open(&path));
let mut buf = vec![0u8; metadata.len() as usize];
try!( buf));
let mut str: &str = try!(str::from_utf8(&buf));
pub struct Brick {
pub peer: Peer,
pub path: Path,
use std::fmt;
impl fmt::Display for Brick {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}:{}", self.peer.hostname, self.path.display())

Keybase proof

I hereby claim:

  • I am dr-emann on github.
  • I am dr_emann ( on keybase.
  • I have a public key whose fingerprint is 4CC6 37E4 32B9 86CB 25A1 7977 D9AC DE1A 2C61 D85D

To claim this, I am signing this object:

//based off
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
use std::env;
fn main() {
let mut file = BufReader::new(File::open("Homo_sapiens.GRCh37.67.dna_rm.chromosome.Y.fa"));
let content = gc_content(&mut file);
println!("{:.2}", content * 100.0);
extern crate getopts;
use std::io::{File, Open, Read};
use std::path::Path;
use std::io::{Command};
use std::string::{String};
use std::os;
use std::str;
View main.c
#include <stdio.h>
int main() {
FILE *fp;
int i;
fp = fopen("\\\\.\\PhysicalDrive0", "r");
for(i = 0; i < 10; i++) {
printf("%x", (int)fgetc(fp));
return 0;
View gist:1d683f2ce03a053d9b06
Everything is in a single crate. The directory structure is as follows:
├── b
│   └──
├── c
│   └──
├── d
│   └──