Skip to content

Instantly share code, notes, and snippets.

View arnar's full-sized avatar

Arnar Birgisson arnar

View GitHub Profile
undefined
;; search.lisp
;; This environment holds the size of the environment,
;; the location of the gold and a bitmask for blocked
;; squares.
(defstruct env
(width 5)
(height 5)
(gold-x-pos 0)
(gold-y-pos 0)
@arnar
arnar / gist:1310968
Created October 25, 2011 00:46
Goodbye...
;int main(void) { printf( /*
(format t ;*/
"goodbye dmr and jmc, thanks for everything!"
); return 0; } /*
(quit)
;*/
@arnar
arnar / spotifyctrl.py
Created October 31, 2011 16:18
Control Spotify from a bottle script
from bottle import route, run, debug
import subprocess
def sendkeys(*keys):
subprocess.call(['xdotool', 'search', '--name', 'Spotify Premium - Linux Preview', 'key'] + list(keys))
return "ok\n"
@route('/pause')
@route('/play')
def play(): return sendkeys('space')
# Project Euler problem 102
# Which side of the line AB is the point P?
# (The dot product of AP and the perpendicular to AB)
def side((ax,ay), (bx,by), (px,py)):
return (bx - ax) * (py - ay) - (by - ay) * (px - ax)
def same_side(a, b, p, q):
sp = side(a, b, p)
sq = side(a, b, q)
;; Personal prefs.
(setq user-mail-address "x")
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
;; Packages and bundles
(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0")
;; Viper mode
diff --git a/src/Syntax.hs b/src/Syntax.hs
index 1905488..475a02a 100644
--- a/src/Syntax.hs
+++ b/src/Syntax.hs
@@ -2,6 +2,7 @@
module Syntax where
import Labels
+import Control.Monad.State
import Data.Generics
---
layout: page
categories:
- title: Journal Papers
publications:
- title: Rule Formats for Determinism and Idempotency (journal version)
date: 31.03.2010
authors:
- Luca Aceto
- Arnar Birgisson
--- setnohs.sorted 2012-01-27 11:45:01.768205853 +0100
+++ seths.sorted 2012-01-27 11:45:23.088143702 +0100
@@ -0,0 +1,2 @@
+n
+t
@@ -21,2 +23,2 @@
-noballooneval
- balloonexpr=
+ ballooneval
+ balloonexpr=GHC_TypeBalloon()
@arnar
arnar / gist:1717737
Created February 1, 2012 16:06
Generate all interleavings in two lists (Haskell)
interleave :: [a] -> [a] -> [[a]]
interleave [] [] = []
interleave as [] = [as]
interleave [] bs = [bs]
interleave as bs = [ (head as):arest | arest <- interleave (tail as) bs ]
++ [ (head bs):brest | brest <- interleave as (tail bs) ]