Skip to content

Instantly share code, notes, and snippets.

/* Sample bubble sort program in Rust.
Tested to compile with rust-0.6.
*/
extern mod std;
extern mod benchmark;
use benchmark::Benchmark;
#[cfg(std_swap)]
fn swap(arr: &mut [uint], left: uint, right: uint) {
use core::vec;
@seawise
seawise / rustbot.rs
Last active August 29, 2015 14:10 — forked from emberian/rustbot.rs
use std::fmt;
use std::io::net::tcp::TcpStream;
use std::io::net::ip::{Ipv4Addr, SocketAddr};
use std::io::buffered::BufferedStream;
#[deriving(Clone)]
pub struct RustBot {
nick: ~str,
user: ~str,
stream: BufferedStream<TcpStream>,
@seawise
seawise / lib.rs
Last active August 29, 2015 14:10 — forked from dradtke/lib.rs
Rust concurrent engine for turn-based games
//! Source file for the `game` crate.
#![allow(dead_code)]
/// The `Player` trait.
pub trait Player {
/// Gets called when it's time for this player to take their turn.
///
/// The game is played by sending commands on `pipe` and checking
/// the responses that are returned.
fn take_turn(&self, pipe: &PlayerActionPipe, round: uint);
@seawise
seawise / gist:a4b60a5afdf66e609133
Last active August 29, 2015 14:03
VIPS installation
# grab latest version of libvips
wget http://www.vips.ecs.soton.ac.uk/supported/7.40/vips-7.40.2.tar.gz
tar xzvf vips-7.40.2.tar.gz
cd vips-7.40.2
# install dependencies, JPG, PNG read/write libraries, EXIF library, etc
sudo yum install -y glib2-devel libxml2-devel libpng-devel libjpeg-devel libexif-devel fftw-devel
# configure and make
./configure