Skip to content

Instantly share code, notes, and snippets.

@CryZe
CryZe / xkcd-936.rs
Created February 14, 2016 19:09
xkcd-936
mod words;
extern crate rand;
use rand::{thread_rng, Rng};
use std::collections::HashSet;
use words::WORDS;
fn main() {
let mut rng = thread_rng();
let mut random_words = HashSet::new();
@CryZe
CryZe / flag_editor.rs
Created March 5, 2016 22:00
Wind Waker Rom Hack - Ingame Flag Editor
#![no_std]
#![feature(asm)]
#[macro_use]
extern crate libtww;
use libtww::system;
use libtww::game::{console, controller, flag};
static mut addr: libtww::Addr = 0x2C;
Running "cargo build":
Updating registry `https://github.com/rust-lang/crates.io-index`
Downloading rustyline v0.2.3
Downloading encode_unicode v0.1.3
Downloading nix v0.5.0
Downloading bitflags v0.4.0
Compiling rustc-serialize v0.3.19
Compiling bitflags v0.4.0
Compiling unicode-width v0.1.3
Compiling encode_unicode v0.1.3
@CryZe
CryZe / beta_quest.rs
Created August 12, 2016 19:16
TWW Beta Quest
#![no_std]
#![feature(asm, const_fn, drop_types_in_const)]
#[macro_use]
extern crate libtww;
mod warp;
use libtww::rand::{XorShiftRng, SeedableRng, Rng};
use warp::{Origin, Destination, Warp, WARPS};
@CryZe
CryZe / hell.rs
Created September 6, 2016 13:19
buf_read from hell
pub fn buf_read<R1, R2, P>(p3b: R1, simgeo: R2, frame: usize) -> Result<Array3D<P>>
where R1: BufRead + Seek,
R2: BufRead + Seek,
P: for<'a> Phases<'a> + Zero + Clone,
for<'a> <P as Phases<'a>>::Phase: FromPrimitive + Zero + Clone
{
...
}
@CryZe
CryZe / bug.rs
Created November 11, 2016 21:06
mutability bug
fn rasterize_mesh<F>(mesh: &[Triangle<F>], domain: &Domain, builder: &Builder<F>)
where F: Float + BaseFloat + FromPrimitive + Send
{
mesh.into_par_iter();
}
error: cannot borrow immutable borrowed content `*mesh` as mutable
--> src\voxelizer.rs:130:5
|
130 | mesh.into_par_iter();
#ifndef _LIVESPLIT_H_
#define _LIVESPLIT_H_
struct Segment_s;
typedef struct Segment_s const *SegmentConstRef;
typedef struct Segment_s *SegmentRef;
typedef struct Segment_s *Segment;
extern Segment Segment_new(char const *name);
struct SegmentList_s;

My solution to this whole issue with Twitch's Community System would be to introduce a Tag based system instead. This is backwards compatible with the Community System. The idea would be that your stream has additional tags that specify additional information that can be searched for. So if you stream a Wind Waker 100% speedrun, you'd have these tags:

nintendo, zelda, wind waker, gamecube, japanese, speedrun, 100%

Now, it is obviously annoying to choose these tags, but the Game selection automatically implicitly selects the tags for this game for you, so for Wind Waker that would be:

nintendo, zelda, wind waker, gamecube

#![no_main]
use std::str;
use std::collections::BinaryHeap;
use std::cmp::{PartialOrd, Ord, Eq, PartialEq, Ordering};
#[derive(Debug, Clone)]
struct Pos {
x: usize,
y: usize,
@CryZe
CryZe / LiveSplitCore.cs
Last active April 25, 2017 22:22
Auto Generated LiveSplit Core Bindings
using System;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;
namespace LiveSplitCore
{
public class Attempt
{
public IntPtr ptr;