Skip to content

Instantly share code, notes, and snippets.

View day23.rs
#![allow(unused)]
mod prelude;
use self::prelude::*;
use rand::Rng;
use std::cmp;
#[derive(Debug, Copy, Clone, Deserialize, PartialEq)]
pub struct Nanobot {
View day22.rs
#![allow(unused)]
mod prelude;
use self::prelude::*;
const DEPTH: usize = 8787;
const TARGET: (usize, usize) = (10, 725);
fn geo_index(x: usize, y: usize, world: &mut Map<(usize, usize), usize>) -> usize {
if let Some(&value) = world.get(&(x,y)) {
View day4.rs
#![feature(dbg_macro)]
#![allow(unused)]
mod prelude;
use self::prelude::*;
#[derive(Debug, Deserialize, PartialOrd, PartialEq, Eq, Ord)]
struct TS {
year: u32,
month: u32,
@tinaun
tinaun / my_oldest_surviving_rust.rs
Last active Nov 21, 2018
my_oldest_surviving_rust.rs
View my_oldest_surviving_rust.rs
// july 2014
use std::io;
use std::from_str::FromStr;
// [], argument is optional, defaults to rax
#[deriving(Show)]
enum Operator {
MOV, // conditional move - MOV reg_from,reg_to,reg_test
IDA, // array index - IDA reg_array,reg_offset,[reg_output]
@tinaun
tinaun / rotating_rect.rs
Created Jun 14, 2018
rotating rect luminance example
View rotating_rect.rs
extern crate luminance;
extern crate luminance_glfw;
use luminance_glfw::{Device, GLFWDevice, WindowDim, WindowOpt, WindowEvent};
use luminance::framebuffer::Framebuffer;
use luminance::shader::program::{Program, Uniform};
use luminance::pipeline::{BoundTexture, RenderState, entry, pipeline};
use luminance::texture::{self, Texture, Sampler, TextureError};
use luminance::pixel;
View main.rs
extern crate gif;
use std::collections::HashMap;
use gif::{Frame, Encoder, Repeat, SetParameter};
use std::fs::File;
use std::io::prelude::*;
static COLOR_MAP: [u8; 15] = [
20, 12, 28, // CLEAN
View day7.rs
use std::collections::HashMap;
#[derive(Debug, Clone, PartialEq)]
struct Node {
weight: u32,
children: Vec<String>,
}
impl Node {
fn weight(&self, map: &HashMap<String, Node>) -> u32 {
You can’t perform that action at this time.