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
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
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
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
### 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
// 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
.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
local type = type; | |
local function deepcopy(obj) | |
local new = {}; | |
local type, constant = type, "table"; | |
for i,v in pairs(obj) do | |
if type(v) == constant then -- if type == "table" | |
new[i] = deepcopy(v); | |
else | |
new[i] = v; |
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
function copy(t) | |
local type, const = type, "table"; | |
local new = {}; | |
for i, v in next, t do | |
if type(v) == const then | |
new[i] = copy(v); | |
else | |
new[i] = v; | |
end | |
end |
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
function int(t) | |
return t:byte(1)+t:byte(2)*0x100+t:byte(3)*0x10000+t:byte(4)*0x1000000 | |
end | |
function num_args(func) | |
local ok, dump = pcall(string.dump,func) | |
if (not ok) then return -1 end | |
local cursor = 13 | |
local offset = int(dump:sub(cursor)) | |
cursor = cursor + offset + 13 |
OlderNewer