Skip to content

Instantly share code, notes, and snippets.

View ympbyc's full-sized avatar
💭
Lisping in the mountains.

Minori Yamashita ympbyc

💭
Lisping in the mountains.
View GitHub Profile
@ympbyc
ympbyc / multiple-projection-transform-animation.lisp
Created July 26, 2023 09:35
opencv projection matrix animation in hylang. the setup is too slow for realtime animation. I decide I'd abandon the idea to use 2D graphics for pseudo-3D animation. go with 3D graphics library.
(import cv2)
(import numpy :as np)
(import matplotlib [pyplot :as plt animation :as plt-anim])
(setv fig (.figure plt))
(setv idxs [] ims [] axs [])
(defn plot [f]
(print f)
@ympbyc
ympbyc / cl-sdl2-render-image.lisp
Last active January 27, 2023 04:50
Load and draw image with CL-SDL2
;; Example use of CL-SDL2
;; Loads Sequentially named PNG image files in "(project-folder)/resources/images" and lay them out
(in-package #:mini-example)
(require :sdl2)
(defun collect-textures (renderer directory)
(loop for i from 10 downto 1
collect
The steel needle cuts through the hills sawing together the cool night.
The needle propells along the curve around the hill.
Sudden light the color of cream shines hard on the silver steel.
Rising moon with bright smokey ring hang low above montains.
The steel maintains momentum and sings in visible frequency.
The sky cassies the disk away in exchange for the light-emitting vertices.
2-sphere has a 3-sky. Does the 3-space have a 4-sky?
@ympbyc
ympbyc / replacer.lisp
Last active May 5, 2020 17:21
html/xml batch structural replacer
(defpackage :replacer
(:use :cl :plump :clss))
(in-package :replacer)
(defun slurp (path)
(with-open-file (stream path)
(let ((data (make-string (file-length stream))))
(read-sequence data stream)
data)))
@ympbyc
ympbyc / emacs-biwa.el
Last active May 18, 2020 01:55 — forked from BilalQadri/emacs-biwa.el
Biwascheme from Emacs (with repl)
;; Initialize Biwascheme interpreter on frontend(browser) then send and receive expressions with websocket client
;; INSTALL websocket.el, LOAD this file and RUN interactive function `load-ws` from Emacs
;; ws-close to close server
;; send expression (e.g functions) to browser with `C-c C-s` ... Tip# cursor should be on function name
(require 'websocket)
(require 'scheme)
(defun biwa-start ()
(interactive)
;(load-file "~/.emacs.d/websocket.el")
@ympbyc
ympbyc / forth.ny
Last active November 29, 2019 05:31
linear programming language
;;;;;;;;; Forth a la Let over Lambda ;;;;;;;;
(defvar forth-registers
'(pstack rstack pc dict compiling dtable))
(defun sym (&rest strs)
(intern (string-upcase (apply #'strcat (mapcar #'string strs)))))
(defmacro defstruct (name &rest slots)
(let ((n -1))
@ympbyc
ympbyc / universal-lisp-transpiler.lisp
Last active September 14, 2019 06:38
[sketch] tools to write transpilers from sexpr to Blub languages. For when you are in the direst situation.
;;[sketch] tools to write transpilers from sexpr to Blub languages.
;;For when you are in the direst situation.
;; copyleft Minori Yamashita
(defpackage :ult
(:use :cl))
(in-package :ult)
(defpackage :ult-symspace)
@ympbyc
ympbyc / pieces-biwa.scm
Last active June 30, 2021 12:46
BiwaScheme glue functions
;;;;;;;;;;;;;;;;;;;;;
;;; generic utils ;;;
;;;;;;;;;;;;;;;;;;;;;
(print "loading generic utils")
;;convenient shorthand for lambda (^ (x) x)
(define-macro (^ params . expr)
`(lambda ,params ,@expr))
;;normalize parameter list e.g. (x), xs, (x . xs) into (x), (xs), (x xs)
@ympbyc
ympbyc / tech-memo.txt
Last active August 12, 2019 21:24
Memo on making a minimally viable workstation
Tech Memo on Minimaly viable work environment
=============================================
Essentials
----------
+ w3m
+ fb-messenger-cli (use with M-x term then M-x mozc-mode)
+ emacs-mozc-bin -- japanese input
@ympbyc
ympbyc / slime-external-timeout.el
Last active March 13, 2019 18:03
Every n seconds check if slime repl is actively updated. if not, interrupt and call a restart that gives up on current operation that's causing the hangup e.g. sockets
;; every 60 seconds check if slime repl buffer has been updated
;; if not intterupt and call restart-1
;; which should abort whatever is causing the hungup and continues
(defvar *slime-repl-last-output* "")
(defvar *slime-repl-watchdog-timer* nil)
(defun handle-sldb-restart ()
(sldb-invoke-restart-1) ;; change here
(message "Invoked restart-1 upon detecting a hungup."))