Skip to content

Instantly share code, notes, and snippets.

View mk12's full-sized avatar

Mitchell Kember mk12

View GitHub Profile
@mk12
mk12 / rectangle.asm
Last active October 10, 2015 21:28
Calculates the area and perimeter of rectangles.
; Copyright 2012 Mitchell Kember. Subject to the MIT license.
; ICS3U / 18-Sept-2012 / Daily Assignment
; Calculates the area and perimeter of rectangles.
; ----------------------------------------
; ------------ READONLY DATA -------------
; ----------------------------------------
section .rodata
@mk12
mk12 / get-myro-on-mac.md
Last active April 5, 2018 14:16
How to install Python and Myro on OS X for the Scribbler Bot.

Get Myro on Mac

There have been some issues getting everything properly installed for the Scribbler Bot project on OS X. It worked for me the first time because I used Homebrew and pip instead of the .mpkg installers. I've done this three times now and it has worked every time, so this should work for you too.

All code blocks are meant to be pasted into the Terminal.

Disclaimer: Follow these instructions at your own risk. I promise they won't do anything bad, but I don't guarantee it. I am not responsible for any unintended consequences.

Remove MacPython

@mk12
mk12 / diamond.s
Created January 29, 2015 18:07
Prints a diamond pattern of N rows with alternating $ and *.
; diamond.s
; Usage:
; diamond <size>
; size is a number from 0 to 300
; If size is greater than 300, 300 will be used
; If size is even, size + 1 (odd) will be used
; If size contains non-numerical characters,
; actual diamond size will be unexpected

We use the Mocha testing framework.

Setup

  • The setup method gets called before each test.
  • Set up @instance_variable in setup, and use it in tests.

Assertions

@mk12
mk12 / vc_checker.py
Created November 21, 2015 18:23
Checks/generates verification conditions for SE 212.
#!/usr/bin/env python3
import fileinput
import re
import sys
def parse():
mode = 'start'
prev_line = ''
conc_next = False
@mk12
mk12 / final.py
Last active April 17, 2017 13:59
Preparation for the CS 341 final exam
#!/usr/bin/env python3
from heapq import heappush, heappop
import random
# Practice for the final exam
###
### Algorithms
@mk12
mk12 / init.sql
Created October 3, 2017 16:31
CS 348 A1 Schema
drop table if exists course;
drop table if exists professor;
drop table if exists student;
drop table if exists class;
drop table if exists enorollment;
drop table if exists mark;
drop table if exists schedule;
create table course (
cnum varchar(5) not null,
@mk12
mk12 / lint.awk
Last active April 22, 2021 17:04
Lint design-history.md
# Usage: gawk --lint=no-ext -f lint.awk docs/concepts/fidl/design-history.md
BEGIN { m = 0; }
/^## By theme/ { m = 1; next; }
m == 1 && /^### / {
theme = $2;
next_idx[theme] = 0;
next;
}
m == 1 && match($0, /^* .*\[RFC-([0-9]+): ([^]]+)\]\[rfc-([0-9]+)\]/, a) {
@mk12
mk12 / guile-syntax-source-issue.md
Last active April 22, 2022 16:17
Getting syntax location in Guile, Racket, and Chez Scheme

I can't figure out why Guile isn't working. In Racket and Chez, getting the source location of #'e works fine. In Guile, it seems to convert to strip off the outer syntax information so that it becomes a list of syntax objects.

@mk12
mk12 / zo-files.diff
Last active May 5, 2022 20:26
Diff of `find . -name "*.zo"` in /usr/local/Cellar/minimal-racket/8.5/ before and after `raco setup`
diff --git a/before-zo.txt b/after-zo.txt
index 058332a..63bfaf7 100644
--- a/before-zo.txt
+++ b/after-zo.txt
@@ -633,3 +633,638 @@
./lib/racket/compiled/usr/local/Cellar/minimal-racket/8.5/share/racket/collects/pkg/private/compiled/install_rkt.zo
./lib/racket/compiled/usr/local/Cellar/minimal-racket/8.5/share/racket/collects/pkg/private/compiled/get-info_rkt.zo
./lib/racket/compiled/usr/local/Cellar/minimal-racket/8.5/share/racket/collects/pkg/private/compiled/lock_rkt.zo
+./share/racket/collects/reader/lang/compiled/reader_rkt.zo
+./share/racket/collects/launcher/compiled/launcher_rkt.zo