Skip to content

Instantly share code, notes, and snippets.

#[test]
pub fn read_aligned_bytes() {
let mut values = Vec::with_capacity(256);
for i in 0 .. 256 {
values.push(i); //commenting this causes the following println!() to execute
// otherwise this println!() does not execute
println!("values.push({})", i);
}
println!("values.len()={}", values.len()); // always executes correctly
.PHONY: run
run: build
qemu-system-i386 bin/vos.bin
.PHONY: build
build: bin bin/vos.bin
bin/vos.bin: bin/util/mkdisk bin/boot/alpha.bin
ld -Lbin/boot/ -o $@ -T src/boot/boot.ld
@JustAPerson
JustAPerson / brain86.rs
Last active August 29, 2015 14:22
Brainfuck compiler
// Brain86
// This program compiles well-formed brainfuck code to x86 assembler.
// Requires rust nightly, nasm, and ld
//
// An interesting sample program:
// https://raw.githubusercontent.com/JustAPerson/brainrust/master/tests/mandelbrot.bf
//
// $ rustc brain86.rs
// $ cat mandelbrot.bf | ./brain86 > mandelbrot.s
// $ nasm -f elf64 mandelbrot.s
### Keybase proof
I hereby claim:
* I am JustAPerson on github.
* I am justaperson (https://keybase.io/justaperson) on keybase.
* I have a public key whose fingerprint is 152C BA67 C94B A770 02EE A3A4 FF7D A5FA 4B3B 039E
To claim this, I am signing this object:
@JustAPerson
JustAPerson / stuff.tl
Last active August 29, 2015 14:19
Tifflang Stuff
def true: zap
def false: swap zap
def and: dup i
def or: swap [dup] dip [] cons dip i
def not: ['false 'true] dip i
def xor: [dup 'not dip] dip i
def zero: zap []
def one: [i] cons
@JustAPerson
JustAPerson / README.md
Last active August 29, 2015 14:16 — forked from anonymous/README.md

Termal

Termal is a library for developing terminal applications using Termbox. Termbox is an ncurses-like library with a very simple API. Termal aims to enable the easy construction of complex interfaces.

Installation

import System.Environment
multiple x n = x `mod` n == 0
multiple3or5 x = multiple x 3 || multiple x 5
problem n = sum $ filter multiple3or5 [1.. n - 1]
main = do
args <- getArgs
if length args == 1 then
putStrLn . show $ problem $ (read (head args) :: Int)
extern crate regexp;
static VARIANTS : [&'static str, ..9 ] = [
"agggtaaa|tttaccct",
"[cgt]gggtaaa|tttaccc[acg]",
"a[act]ggtaaa|tttacc[agt]t",
"ag[act]gtaaa|tttac[agt]ct",
"agg[act]taaa|ttta[agt]cct",
"aggg[acg]aaa|ttt[cgt]ccct",
"agggt[cgt]aa|tt[acg]accct",
@JustAPerson
JustAPerson / test.rs
Created January 21, 2014 01:58
How to reference from index operator?
struct Buffer<T> {
list: ~[Option<T>],
size: uint,
}
impl<T: Clone> Buffer<T> {
pub fn new(size: uint) -> Buffer<T> {
let mut list: ~[Option<T>] = ~[];
list.reserve(size);
Buffer {
list: list,
@JustAPerson
JustAPerson / .vimrc
Created August 24, 2013 02:50
So basic
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
Bundle 'leafo/moonscript-vim'