Skip to content

Instantly share code, notes, and snippets.

View kristianlm's full-sized avatar

Kristian Lein-Mathisen kristianlm

View GitHub Profile
(use spiffy matchable test channel)
(include "server.scm")
(include "alist-util.scm")
;; events: `(event ...)
;; event: `(ekey event)
;; ekey: `(atype aid)
;; ==================== event-store ====================
(define (make-event-store) `(event-store . () ))
#include <stdio.h>
#include <alsa/asoundlib.h>
static char card[64] = "default";
static void error(const char *fmt,...)
{
va_list va;
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := src/core/epbase.c src/core/sock.c src/core/poll.c \
src/core/symbol.c src/core/ep.c src/core/pipe.c \
src/core/sockbase.c src/core/global.c src/devices/device.c \
src/transports/inproc/ins.c src/transports/inproc/inproc.c \
src/transports/inproc/cinproc.c src/transports/inproc/binproc.c \
src/transports/inproc/sinproc.c src/transports/inproc/msgqueue.c \
// code from http://paulbourke.net/miscellaneous/dft/
// help from http://www.codeproject.com/Articles/9388/How-to-implement-the-FFT-algorithm
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
/*
This computes an in-place complex-to-complex FFT
x and y are the real and imaginary arrays of 2^m points.
dir = 1 gives forward transform
@kristianlm
kristianlm / Xresources
Last active August 29, 2015 14:22
configuration.nix
! Use a nice truetype font and size by default...
! xterm ----------------------------------------------------------------------
xterm*VT100.geometry: 80x25
xterm*faceName: Inconsolata:style=Regular:size=8
!xterm*font: -*-dina-medium-r-*-*-16-*-*-*-*-*-*-*
xterm*dynamicColors: true
xterm*utf8: 2
xterm*eightBitInput: true
xterm*saveLines: 65568
@kristianlm
kristianlm / chicken-scheme-opengl-hello-world.scm
Created February 17, 2012 13:00
chicken scheme - opengl hello world in 35 lines (gl, glu, glut)
(begin
(require-extension gl)
(require-extension glut)
(require-extension glu)
(glut:InitDisplayMode (+ glut:DOUBLE glut:RGBA glut:DEPTH))
(glut:InitWindowSize 400 300)
(glut:CreateWindow "gl hello world"))
(begin
@kristianlm
kristianlm / gist:1898187
Created February 24, 2012 05:57
hello-world from Chicken Scheme with Box2D
(require-extension coops bind cplusplus-object )
#>
#include <Box2D.h>
// is there a way to access c++ class-fields without these
// two silly helpers?
float getBodyPositionX (b2Body* b) { return b->GetPosition ().x; }
float getBodyPositionY (b2Body* b) { return b->GetPosition ().y; }
<#
@kristianlm
kristianlm / gist:3397261
Created August 19, 2012 19:51
how to do nested loops in C -> Elegant Scheme
;; I can't seem to convert this neat little
;; C code into elegant Scheme:
;;
;; // I didn't test this:
;; int c[20][20]
;; for (int x = -10 ; x < 10 ; x++)
;; for (int y = -10 ; y < 10 ; y++)
;; c[x+10][y+10] = x + y;
@kristianlm
kristianlm / gist:4108390
Created November 19, 2012 00:50
Running ViennaCL on Amazon GPU cluster (cg1.4xlarge)
[ec2-user@ip-10-33-4-246 grub]$ lspci
00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 01)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 3D controller: nVidia Corporation GF100 [Tesla S2050] (rev a3)
00:04.0 3D controller: nVidia Corporation GF100 [Tesla S2050] (rev a3)
00:05.0 Unassigned class [ff80]: XenSource, Inc. Xen Platform Device (rev 01)
@kristianlm
kristianlm / gist:4185312
Created December 1, 2012 21:46
emacs compiling rudel with elpa fails
Leaving directory `/home/klm/.emacs.d/elpa/eieio-1.4'
Compiling file /home/klm/.emacs.d/elpa/eieio-1.4/eieio-comp.el at Sat Dec 1 21:29:38 2012
Entering directory `/home/klm/.emacs.d/elpa/eieio-1.4/'
In byte-compile-file-form-defmethod:
eieio-comp.el:95:30:Warning: reference to free variable `bytecomp-outbuffer'
eieio-comp.el:96:35:Warning: reference to free variable `outbuffer'
In end of data: