Skip to content

Instantly share code, notes, and snippets.

View kristianlm's full-sized avatar

Kristian Lein-Mathisen kristianlm

View GitHub Profile
@kristianlm
kristianlm / Chipmunk.mk
Created May 7, 2012 15:56
Building Chipmunk for Android: An Android NDK module for Chipmunk Physics Engine
# This makefile will let the Android NDK build a
# libchipmunk.so to go with your 2D Android game.
# download the Chipmunk sources and do
# $ cd <chipmunk-physics>
# $ git checkout Chipmunk-6.0.3 # if you downloaded from source
# $ mkdir -p modules/chipmunk && cd modules/chipmunk
# $ cat >Android.mk <<EOF
LOCAL_HOME := $(dir $(lastword $(MAKEFILE_LIST)))
@kristianlm
kristianlm / constant folding.scm
Created January 2, 2024 20:43
s-expression constant folding experiment
(import test matchable)
;; how to turn
`(* 2 (+ x 3 (+ 4 10)) y 10)
;; into `(* 20 (+ 17 x ) y) ?
`(+ (+ 1 2 x) (+ 3 4 x) 5) =>
`(+ 15 x x)
(begin
@kristianlm
kristianlm / system.scm
Created September 13, 2022 09:10
Custom services in Guix
;; I find it hard to read the Guix Manual and figure out how to make a custom shepherd service
;; that just keeps a process running. I came up with this and though it was a keeper:
(operating-system
(service (service-type
(name 'tmuxkirc')
(extensions
(list (service-extension
shepherd-root-service-type
;;; I named this "hetzner", but the only VPS-specific feature is
;;; probably the virtio_scsi initrd module addition.
;;;
;;;
;;; OBS: change id_ed25519.pub below to id_rsa.pub unless you've used my favorite key algorithm:
;;;
;;; ssh-keygen -t ed25519
;;;
(use-modules (gnu)
(gnu packages ssh))
@kristianlm
kristianlm / config.scm
Last active August 13, 2022 20:42
can't build etc-polkit-1 on guix @ a8bd13c3993810428fc2e207791465bd8b297a17
(use-modules (gnu)
(gnu packages shells)
(gnu packages ssh)
(gnu services pm)
((gnu services cups) #:select (cups-service-type cups-configuration))
(gnu packages cups)
(gnu services sound)
(gnu packages wm)
(gnu services virtualization)
((gnu packages gnustep) #:select (windowmaker))
@kristianlm
kristianlm / config.snippet.scm
Last active August 9, 2022 07:58
guix i3status-rust: remove kdeconnect dependency
(define-public i3status-rust-no-kdeconnect
(package
(inherit i3status-rust)
(name "i3status-rust-no-kdeconnect")
(arguments
(substitute-keyword-arguments (package-arguments i3status-rust)
((#:phases old-phases)
#~(modify-phases #$old-phases
(replace 'wrap-i3status
(lambda* (#:key outputs inputs #:allow-other-keys)
/gamepad-train-main
/gamepad-train
/gamepad-train.build.sh
/gamepad-train.install.sh
/gamepad-train.link
;;; trying to implement avro binary encoding
;;; as described here:
;;; https://avro.apache.org/docs/current/spec.html#map_encoding
;;;
(import chicken.string chicken.bitwise chicken.io chicken.port
(only chicken.memory.representation number-of-bytes)
(only chicken.random random-bytes)
zstd medea matchable test)
(define (debug . args)