This file contains hidden or 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
#!/bin/sh | |
set -e # Stop on first error | |
PREFIX=/opt/osm | |
tar xfz binutils-2.23.tar.gz | |
mkdir build-binutils; cd build-binutils | |
../binutils-2.23/configure --target=mips-elf --prefix=$PREFIX | |
make | |
sudo make install |
This file contains hidden or 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
(defun kb (k) (read-kbd-macro k)) | |
(dolist (pair | |
'(("C-k" kill-whole-line) | |
("C-n" dabbrev-expand) | |
("C-x C-g" goto-line) | |
("C-<tab>" next-multiframe-window) | |
)) | |
(global-set-key (kb (car pair)) (cadr pair))) |
This file contains hidden or 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
(* 4M1 *) | |
local | |
val jens = PLAYER "Jens" | |
val mette = PLAYER "Mette" | |
val ian = PLAYER "Ian" | |
val helle = PLAYER "Helle" | |
val yuan = PLAYER "Yuan" | |
val anne = PLAYER "Anne" | |
val yasmin = PLAYER "Yasmin" |
This file contains hidden or 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
datatype bentSpil = BentSlutter of int | |
| BentSpiller of ingeSpil list | |
and ingeSpil = IngeSlutter of int | |
| IngeSpiller of bentSpil list | |
(* bent8 *) | |
local | |
val inge3 = IngeSpiller [ BentSlutter 0 ] | |
val inge4 = IngeSpiller [ BentSlutter 0, BentSlutter 1 ] |
This file contains hidden or 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
datatype bentSpil = BentSlutter of int | |
| BentSpiller of ingeSpil list | |
and ingeSpil = IngeSlutter of int | |
| IngeSpiller of bentSpil list | |
(* bent8 *) | |
val inge3 = IngeSpiller [ BentSlutter 0 ] | |
val inge4 = IngeSpiller [ BentSlutter 0, BentSlutter 1 ] |
This file contains hidden or 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
-module(simple_chatserver). | |
-export([start/0]). | |
-define(PORT, 33333). | |
% External API function for starting chat server | |
start() -> | |
% Start a process for coordinating communication between clients | |
CoordinatorPid = spawn(fun() -> coordinator(dict:new()) end), | |
% Listen to a TCP socket and start a process that accepts incoming |
This file contains hidden or 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
-module(simple2). | |
-export([start/0]). | |
-define(PORT, 33333). | |
start() -> | |
{ok, spawn(fun listener/0)}. | |
listener() -> | |
ChatMaster = spawn(fun() -> chatmaster(dict:new()) end), | |
{ok, ListenSocket} = gen_tcp:listen(?PORT, [binary, {active, true}]), |
This file contains hidden or 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 | |
fun fbstr i = | |
case (i mod 3 = 0, i mod 5 = 0) of | |
(true , true ) => "FizzBuzz" | |
| (true , false) => "Fizz" | |
| (false, true ) => "Buzz" | |
| (false, false) => Int.toString i | |
fun fizzbuzz' (n, j) = |
This file contains hidden or 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
{ | |
(* A position in a file is identified as a (line,column) : int * int *) | |
type position = int * int | |
(* Lexical errors have some error message and a position in the file *) | |
exception LexicalError of string * position (* (message, (line, column)) *) | |
(* While scanning the file, line numbers and the character offset (the integer | |
position for the character in the file) for each beginning line are kept |
This file contains hidden or 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
# RISK Attack Simulation | |
attack <- function(na, nb) { | |
die <- 1:6 | |
while (na > 0 & nb > 0) { | |
attackers <- min(na, 3) | |
defenders <- min(nb, 2) | |
fights <- min(attackers, defenders) | |
hit_a <- sort(sample(die, attackers), decreasing=T)[1:fights] |