Skip to content

Instantly share code, notes, and snippets.

☂️
Umbrella

rain1 rain-1

View GitHub Profile
@rain-1
rain-1 / markdown.md
Created Apr 17, 2019
gopher markdown specification
View markdown.md

My Markdown Spec

This is (yet) another markdown specification. The purpose of this particular markdown spec is to provide a single unambiguous markdown specification. It aims to use formal regular expressions so that implementors can quickly create implementations (given a regex library) and the results will be consistent across platforms. We specify a very small subset of the markdown seen in the wild.

Version 0.1

@rain-1
rain-1 / mytv.vala
Created Apr 7, 2019
bold text in vala
View mytv.vala
using Gtk;
// valac --pkg gtk+-3.0 mytv.vala
public class MarkupTextView : TextView {
public void append_text (string s) {
TextIter end_iter;
buffer.get_end_iter (out end_iter);
buffer.insert_with_tags_by_name (ref end_iter, s, -1, null);
}
View checksum-colorizer.go
package main
import (
"bufio"
"fmt"
"os"
"log"
"regexp"
)
@rain-1
rain-1 / another way
Last active Mar 12, 2019
k-n-combinations.rkt
View another way
#lang racket
(require racket/stream)
(define (make-prefix len)
(lambda (tail)
(append (make-list len '_) (cons 'o tail))))
(define (k-combinations k n)
(cond ((= k 0)
@rain-1
rain-1 / set.rkt
Created Mar 4, 2019
generalized set! in racket - failed idea
View set.rkt
#lang racket
(require (for-syntax racket/syntax))
(define toplevel 'foo)
(define-syntax (set^ stx)
(syntax-case stx ()
[(_ (attr x) y)
(with-syntax ([set-attr! (format-id #'toplevel "set-~a!" (syntax-e #'attr))])
@rain-1
rain-1 / serialize-lisp.rkt
Created Feb 17, 2019
serialize-lisp.rkt
View serialize-lisp.rkt
#lang racket
;; This implements a baby lisp interpreter using closure conversion pass before execution
;; It supports serialization of closures (e.g. for partial evaluation/staging) and reading back and executing those objects
(require data/queue)
;; closure conversion for lambda calculus
;;
;; the input language is:
View closure-conversion.rkt
#lang racket
;; this is a stand alone simple version of the closure conversion part of the hoist pass from the tarot compiler
;; see https://rain-1.github.io/scheme for more.
(require data/queue)
;; closure conversion for lambda calculus
;;
;; the input language is:
@rain-1
rain-1 / grammar-1.rkt
Last active Feb 7, 2019
parsing with grammars
View grammar-1.rkt
#lang racket
;(start, (ACCEPT))
;(start, (READ #\a, sym))
;(start, (READ #\b, sym))
;(start, (READ #\(, "sexps"), PUSH(#\)))
;(sym, (ACCEPT))
;(sym, (READ #\a, sym))
;(sym, (READ #\b, sym))
@rain-1
rain-1 / minikanren.scm
Created Jan 6, 2019
minikanren.scm - based off orchid-hybrid mirukanren. works in Chez
View minikanren.scm
;; utils
(define (assp p l)
(if (null? l)
#f
(if (p (caar l))
(car l)
(assp p (cdr l)))))
@rain-1
rain-1 / boot.S
Created Sep 30, 2018
GNU assembly bootloader
View boot.S
.code16
.global _start
_start:
cli
xor %ax, %ax
mov %ax, %ds
mov $msg, %si
cld
loop:
lodsb
You can’t perform that action at this time.