Skip to content

Instantly share code, notes, and snippets.

Kristian Lein-Mathisen kristianlm

  • Adellica
  • Norway
Block or report user

Report or block kristianlm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kristianlm / gdigrab.c
Last active Aug 15, 2018
Screen Capture of your Windows10 machine as a http://<ip>:8088/image.png
View gdigrab.c
#include <windows.h>
#include <stdio.h>
int screen_w() {
return GetSystemMetrics(SM_CXVIRTUALSCREEN)
- GetSystemMetrics(SM_XVIRTUALSCREEN);
int screen_h() {
View server-demo.scm
(use minissh nrepl)
;; the default /dev/random causes hangs
(use tweetnacl) (current-entropy-port (open-input-file "/dev/urandom"))
;; the secret key would normally be kept safe
(define host-pk
(define host-sk
kristianlm / generators.scm
Last active Sep 29, 2017
a sample generator API for Scheme, implemented using continuations
View generators.scm
;;; generator function example, inspired by this post:
;;; Kristian Lein-Mathisen 2017
(import (scheme small))
; current-continuation : -> continuation
(define (current-continuation)
View freeimage-show-in-terminal.c
// show an image in the terminal using ascii colors
// demonstrates raw pixel access
// (only works on certain image file types, though)
#include <stdio.h>
#include <FreeImage.h>
int meta(FIBITMAP *dib) {
FITAG *tag = NULL;
FIMETADATA *mdhandle = NULL;
mdhandle = FreeImage_FindFirstMetadata(FIMD_EXIF_MAIN, dib, &tag);
View alst.scm
;; a nicer alist api
(define (aref alst key #!optional (missing (lambda () #f)) (= equal?))
(let loop ((alst alst))
(if (pair? alst)
(if (= (caar alst) key) (cdar alst) (loop (cdr alst)))
(if (procedure? missing) (missing) missing))))
(define (adel alst key #!optional (= equal?))
(alist-delete key alst =))
[u2@user1-pc chicken-android-template-master]$ export PATH=$PATH:/home/u2/android/android-ndk-r11c:/home/u2/android/android-sdk-linux/platform-tools:
[u2@user1-pc chicken-android-template-master]$ export ANDROID_HOME=/home/u2/android/android-sdk-linux
[u2@user1-pc chicken-android-template-master]$ make
Warning: excluded identifier doesn't exist in module chicken: define-macro
make -C jni/chicken # should build the cross-chicken
make[1]: Entering directory '/home/u2/Desktop/chicken-android-template-master/jni/chicken'
Warning: excluded identifier doesn't exist in module chicken: define-macro
echo /home/u2/Desktop/chicken-android-template-master/jni/chicken/chicken-core/
View grid-module.scm
(module grid *
(import chicken scheme ports)
(include "grid.scm"))
View font8x8.scm
;;; example macro for embedding raw data (in this case a font) as a
;;; "binary blob" during compile-time.
(use srfi-1)
(define-syntax make-font
(lambda (form r t)
;; specs is ((index scanlines ...) ...)
(let ((specs (cdr form)))
View test.patch
modified hello-world.c
@@ -1,6 +1,5 @@
#include <stdio.h>
int main() {
- fprintf(stderr, "Goodbye, ");
- fputs("World!\n", stderr);
+ fprintf(stderr, "Goodbye, World!\n");
return 0;
You can’t perform that action at this time.