Skip to content

Instantly share code, notes, and snippets.

Thorsten Ball mrnugget

Block or report user

Report or block mrnugget

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

Scheme x86 Compiler - Debugging wrong call


((lambda (g x) (g x)) (lambda (x) (prim-apply + 1 x)) 2)

Problem: generated code contains two functions.

mrnugget / reproduce_github_eof.go
Created Jun 4, 2019
This can be used to reproduce EOF errors while using GitHubs API, because GitHub closes keep-alive connections after 60s.
View reproduce_github_eof.go
package main
import (
mrnugget /
Last active Apr 2, 2019
Steve Yegge - Notes from the Mystery Machine Bus. This is a mirror of the post on Google+, kept here for safekeeping when Google+ shuts down tomorrow. (converted to Markdown by pasting it into Dropbox Paper and exporting as Markdown)

Note: I'm not the original author. That's Steve Yegge. I copied the essay here from Google+ for safekeeping before Google+ shuts down.

Author: Steve Yegge

Publication Date: 10 Aug 2012

Notes from the Mystery Machine Bus

I've spent the past eight years (starting back in June 2004) writing elaborate rants about a bunch of vaguely related software engineering issues.

mrnugget / op_get_self.diff
Last active Mar 20, 2019
Fix for recursive closures that are defined in other functions. These break in version 1.0 of "Writing A Compiler In Go". This fix adds another opcode, OpGetSelf, and emits it whenever there's a reference to the currently executed function.
View op_get_self.diff
diff --git a/ast/ast.go b/ast/ast.go
index 8db3b39..f0420f4 100644
--- a/ast/ast.go
+++ b/ast/ast.go
@@ -2,6 +2,7 @@ package ast
import (
+ "fmt"
mrnugget / 01_vm_test.go
Last active May 29, 2019
Little bug in "Writing A Compiler In Go" 1.0
View 01_vm_test.go
func TestCallingRecursiveFunctionsInFunctions(t *testing.T) {
tests := []vmTestCase{
// This works
input: `
let inner = fn(x) {
if (x == 0) {
return 0;
} else {
inner(x - 1);
View Brewfile.rb
# vim: set ft=ruby
cask_args appdir: '/Applications'
tap 'homebrew/cask'
brew 'mas'
brew 'git'
brew 'zsh'
brew 'make'
mrnugget / conways.rkt
Created Nov 24, 2018
Conway's Game of Life in Racket
View conways.rkt
#lang racket
(define (make-grid rows columns)
(build-vector rows (lambda (r) (make-vector columns 0))))
(define (rows grid) (vector-length grid))
(define (columns grid) (vector-length (vector-ref grid 0)))
(define (cell grid row column)
(cond [(or (< row 0) (< column 0)) 0]
View go_module_jitting.go
package main
import (
mrnugget / go_jit.go
Created Aug 17, 2018
JITting a function that writes the letter 'H' to a bytes buffer
View go_jit.go
package main
import (
mrnugget / pipe_to_jq.el
Last active Jun 27, 2018
This binds `<leader>jq` to a command that pipes the current visual selection in evil-mode to `jq` and replaces it with the output.
View pipe_to_jq.el
;; Taken from here:
(defun shell-command-on-region-and-select
(start end command
&optional output-buffer replace
error-buffer display-error-buffer
"Wrapper for 'shell-command-on-region', re-selecting the output.
Useful when called with a selection, so it can be modified in-place"
You can’t perform that action at this time.