Skip to content

Instantly share code, notes, and snippets.

View sshine's full-sized avatar
🦀

Simon Shine sshine

🦀
View GitHub Profile
(defun select-next-window ()
"Switch to the next window"
(interactive)
(select-window (next-window)))
(defun select-previous-window ()
"Switch to the previous window"
(interactive)
(select-window (previous-window)))
@sshine
sshine / skabelon.tex
Created September 21, 2012 17:12
Skabelon til LaTeX-workshop
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\author{John Doe}
\title{... før nu og i fremtiden}
@sshine
sshine / gist:3781152
Created September 25, 2012 10:56
xmobarrc
Config { font = "-*-Fixed-*-R-Normal-*-13-*-*-*-*-*-*-*"
, bgColor = "black"
, fgColor = "grey"
, position = Top
, commands = [
Run Cpu ["-L","5","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Date "%a %b %_d %H:%M" "date" 10
, Run BatteryP ["BAT0"] ["-t","<acstatus><left>%","--",
"-O","<fc=green>+</fc>","-o","<fc=red>-</fc>",
@sshine
sshine / klassedelinger.sml
Created November 7, 2012 04:01
klassedelinger.sml
(* concatMap : ('a -> 'b list) -> 'a list -> 'b list
* Forklaring:
* f x = [y1,...,yn]
* map f xs = [[a1,...,an], [b1,...,bn], ..., [z1,...,zn]]
* concat (map f xs) = [a1,...,an,b1,...,bn,z1,...zn] *)
fun concatMap f xs = List.concat (map f xs)
(* foranNte x xss n: sætter x som det første element i den n'te liste i xss.
* Eks.: foranNte 0 [[1,2],[3,4],[5,6],[7,8]] 2 = [[1,2],[3,4],[0,5,6],[7,8]]
*)
@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])
@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: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 / 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 / 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)
;; 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>")))