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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |