Skip to content

Instantly share code, notes, and snippets.

View marvinguo's full-sized avatar

Marvin Guo marvinguo

View GitHub Profile
@andelf
andelf / cpuid.rs
Created April 18, 2014 10:39
CPUID in Rust
#![feature(asm)]
use std::io;
fn cpuid(info: u32) -> (u32, u32, u32, u32) {
let (mut a, mut b, mut c, mut d) = (0,0,0,0);
unsafe {
asm!("mov $4, %eax
cpuid
@andelf
andelf / simple_chat.rs
Last active April 13, 2024 15:09
Simple Socket Chat Server in Rust. (TcpListener, TcpStream, SharedChan, RWArc)
extern mod sync;
// str op trait
use std::str::StrSlice;
// for tcp listen
use std::io::{TcpListener, TcpStream};
use std::io::net::ip::SocketAddr;
// for trait
use std::io::{Listener, Writer, Acceptor, Buffer};
// for spawn