Skip to content

Instantly share code, notes, and snippets.

View r-moeritz's full-sized avatar

Ralph r-moeritz

  • Adelaide SA
View GitHub Profile
@r-moeritz
r-moeritz / pretty-literals.lisp
Created June 24, 2011 10:30
pretty hash table & vector literal syntax for common lisp
;;;; pretty-literals.lisp - pretty hash table & vector literal syntax
;;;; inspired by and uses code from http://frank.kank.net/essays/hash.html
(in-package #:pretty-literals)
;; vector literal syntax using brackets
(set-macro-character #\[
(lambda (str char)
(declare (ignore char))
(let ((*readtable* (copy-readtable *readtable* nil))
@r-moeritz
r-moeritz / init.el
Created June 28, 2011 21:28
My init.el
;; -*- mode: Lisp; lexical-binding: t; -*-
;; ----------------------------------------------------------------------
;; HELPER FUNCTIONS
;; ----------------------------------------------------------------------
(defvar electrify-return-match
"[\]}\)\"]"
"If this regexp matches the text after the cursor, do an \"electric\"
return.")
@r-moeritz
r-moeritz / findprgadr.s
Last active May 2, 2020 17:30
Determine program start address and print it (in decimal)
; findprgadr.s
;
; find and print program address
; works by calling into a rom routine, causing the sp to be saved.
*= $c0f7
linprt = $bdcd
findadr sei ; stop irqs from touching the stack
@r-moeritz
r-moeritz / ed.s
Created May 1, 2020 10:37
Mr. Ed: simple C64 fullscreen text editor
; Mr. Ed by Chris Miller Jul, 1986
; *** constants ***
columns = 40 ; screen size
linesize = 250 ; max allowed
screenbeg = 1024+40 ; top of text scr
screenend = 2024 ; end of text scr
rows = 24 ; screenend-screenbeg/columns
; *** important memory ***
@r-moeritz
r-moeritz / demo-ras64.bas
Last active October 20, 2019 08:35
Raster interrupt sample from Compute's Machine Language Routines for the Commodore 64/128
5 sys 49152
10 print chr$(147):poke 49408+33,0:poke 49455+33,0
15 for a=832 to 896:poke a,255:next
20 for a=2040 to 2047:poke a,13:next
30 poke 49408+21,255:poke 49455+21,255
40 for a=49408 to 49422 step 2:poke a,b*25+50:poke a+47,b*25+50:b=b+1:next
50 for a=49409 to 49423 step 2:poke a,100:poke a+47,200:next
@r-moeritz
r-moeritz / goals.vb
Last active June 3, 2018 09:30
Libreoffice financial macros
REM ***** BASIC *****
Function VLOOKUP(SearchValue As Variant, CellRange As Object, Column As Integer, Mode As Integer) As Variant
Dim svc As Object
Dim arg AS Variant
svc = createUnoService("com.sun.star.sheet.FunctionAccess")
arg = Array(SearchValue, CellRange, Column, Mode)
VLOOKUP = svc.callFunction("VLOOKUP", arg)
@r-moeritz
r-moeritz / DuckTyping.cs
Created September 6, 2012 10:37
Sample RequireJS type modules in C#
namespace DuckTyping
{
using System;
class Aviary
{ // The Aviary "module"
public class __Duck__
{
public void Quack()
{
@r-moeritz
r-moeritz / gist:3212298
Created July 31, 2012 00:37
ECL compile again
(in-package #:c)
(defparameter *compile-in-constants* t)
(in-package #:cl-user)
(compile-file "hello.lisp" :system-p t)
(c:build-program "binary" :lisp-files '("hello.obj"))
@r-moeritz
r-moeritz / gist:3212295
Created July 31, 2012 00:37
c:build-program
(c:build-program "binary" :lisp-files '("hello.obj"))
@r-moeritz
r-moeritz / hello.lisp
Created July 31, 2012 00:34
ECL Hello World
(princ "Hello world!")
(terpri)
(quit)