This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; 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 | |
(er-macro-transformer | |
(lambda (form r t) | |
;; specs is ((index scanlines ...) ...) | |
(let ((specs (cdr form))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(module grid * | |
(import chicken scheme ports) | |
(include "grid.scm")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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 =)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; generator function example, inspired by this post: | |
;;; http://matt.might.net/articles/programming-with-continuations--exceptions-backtracking-search-threads-generators-coroutines/ | |
;;; | |
;;; Kristian Lein-Mathisen 2017 | |
(import (scheme small)) | |
; current-continuation : -> continuation | |
(define (current-continuation) | |
(call-with-current-continuation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 | |
"AAAAC3NzaC1lZDI1NTE5AAAAIIfd+rbtTF2hJJbnnbQxtp2UVrUWkQtnsT8CL9iLpZBZ") | |
(define host-sk | |
#${ba72291c15494ee02003b3c0bb0f8507a6a803850aa811d015b141a193e2447d |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <stdio.h> | |
int screen_w() { | |
return GetSystemMetrics(SM_CXVIRTUALSCREEN) | |
- GetSystemMetrics(SM_XVIRTUALSCREEN); | |
} | |
int screen_h() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;(define cal (with-input-from-file "v2020.scm" read)) | |
;;2020 | |
(define cal | |
`( | |
;;w mtotfls | |
( 5 dfaadff) | |
(23 dfnnfff) | |
)) | |
(import chicken.io |