Skip to content

Instantly share code, notes, and snippets.

View sshine's full-sized avatar
🦀

Simon Shine sshine

🦀
View GitHub Profile
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 ]
(* 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"
(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)))
@sshine
sshine / osm-setup.sh
Created April 1, 2013 00:44
Notes on building GCC as a cross-compiler for MIPS
#!/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
;; I don't use these macros very often, but I keep them here because they
;; might be useful if I should want to make similar macros in the future.
(defun absalon-html-escape-code ()
"Wrap marked region with HTML pre codes."
(interactive)
(save-excursion (goto-char (region-beginning))
(insert "<pre style=\"background: #eee; padding: 1em\">\n"))
(save-excursion (goto-char (region-end))
(insert "</pre>")))
@sshine
sshine / BFName.hs
Last active December 12, 2015 02:28
A simple Haskell program for generating Brainfuck-code that prints strings. Append "[.>]" to print.
module BFName where
import Data.Char
import Data.List
makeName :: String -> String
makeName = makeBase
(***) :: String -> Int -> String
s *** n = concat (replicate n s)
@sshine
sshine / dprint.sh
Created December 2, 2012 16:30
DIKU print program
#!/bin/sh
PRINTER=s2a
COPIES=1
ARGS=""
HOST=tyr
DRY=0
if ! opts=$(getopt -o p:n:r:h:fd24 -l fit,duplex,host:,range:,dry -- "$@")
then
echo "Usage: dprint [-p printer] [-n copies] [--fit] [--duplex] [-2 | -4]"
@sshine
sshine / gist:4142387
Created November 25, 2012 04:23
Printing at DIKU
#!/bin/sh
PRINTER=s2a
COPIES=1
ARGS=""
HOST=tyr
DRY=0
if ! opts=$(getopt -o p:n:r:h:fd24 -l fit,duplex,host:,range:,dry -- "$@")
then
echo "Usage: dprint [-p printer] [-n copies] [--fit] [--duplex] [-2 | -4]"
@sshine
sshine / gist:4138035
Created November 24, 2012 01:58
Emacs bindings
(defun kb (k) (read-kbd-macro k))
(dolist (pair
'(("C-z" undo)
("C-k" kill-whole-line)
("M-c" comment-region)
("M-u" uncomment-region)
("C-<return>" mark-paragraph)
("C-n" dabbrev-expand)
("C-g" goto-line)
("C-+" text-scale-increase)
@sshine
sshine / gist:4051547
Created November 10, 2012 16:22
praeorden, erstat, sorter
(* Opgave 5 *)
datatype 'a trae = K of 'a * ('a trae list)
(* a *)
local
val v7 = K (7, [])
val v6 = K (6, [])
val v5 = K (5, [v6, v7])
val v1 = K (1, [])
val v4 = K (4, [v7, v1, v5])