Skip to content

Instantly share code, notes, and snippets.


Andrew Gwozdziewycz apg

View GitHub Profile
View map.scm
;; map, the naive way
(define (naive-map f xs)
((null? xs) '())
(else (cons (f (car xs)) (map f (cdr xs))))))
(define (tr-map f xs)
(define (recurse f xs accum)
((null? xs) (reverse accum))
View haiku-mode.el
(defface haiku-success-face
'((t :inherit success))
:group 'haiku-mode)
(defface haiku-error-face
'((t :inherit warning))
:group 'haiku-mode)
(defvar haiku-highlight-keywords
apg / wc.d
Created Jun 1, 2018
Simple wc(1) in D
View wc.d
// $ dmd wc.d
// $ cat /usr/share/dict/words | ./wc
// 235886 235886 2493109
import std.stdio;
void main()
int lines = 0;
int words = 0;
apg /
Created Apr 18, 2018
Elon Productivity tips

Source of quoted email.

Btw, here are a few productivity recommendations:

  • Excessive meetings are the blight of big companies and almost always get worse over time. Please get of all large meetings, unless you’re certain they are providing value to the whole audience, in which case keep them very short.

  • Also get rid of frequent meetings, unless you are dealing with an extremely urgent matter. Meeting frequency should drop rapidly once the urgent matter is resolved.

  • Walk out of a meeting or drop off a call as soon as it is obvious you aren’t adding value. It is not rude to leave, it is rude to make someone stay and waste their time.

apg /
Created Dec 26, 2017
Nick P’s post on methods

Techniques for Ensuring Software Correctness: What Worked in Past and Present (Quick revision of 2016 comment on

I find it helps to look to prior successes and tradeoffs to try to understand how to best do engineering. People and teams I've identified as independent inventors of software engineering were Bob Barton of Burroughs B5000, Dijkstra w/ THE OS, and Margaret Hamilton in Apollo & 001 Tool Suite. Each had pieces of the problem with some culminating with later work into the TCSEC and Orange Book’s B3/A1 classes of high-assurance security. At IBM, Fagan invented formal, software inspections for lower defects. Harlan Mills invented a method, Cleanroom Software Engineering, that consistently resulted in low defects even on first use. Became my baseline.

In parallel, the safety-critical embedded community continued using all kinds of their own methods or variations on common ones. They often published "lessons learned" reports with useful information. CompSci researchers continued working on

apg /
Created Dec 23, 2017
Prototype: using Go's ast tools to build a comment parsing contract engine.


$ go run law.go
package main

import "fmt"

// @require: not-empty: len(x) > 0
func Foo(x string) {
apg / enables.scrbl
Last active Nov 16, 2017
Using the functions in graphviz.rkt, we now can do the things in enables.scrbl
View enables.scrbl
@(require "graphviz.rkt")
@(require scriblib/figure)
@graphviz-figure["foo-bar" "Overview of Foo Bar"]{
digraph G {
foo -> bar
bar -> baz
baz -> quux
quux -> foo
View json.rkt
#lang racket/base
;; Roughly based on the PLaneT package by Dave Herman,
;; Originally released under MIT license.
;; edited: Matthias, organization in preparation for pretty-print
;; -----------------------------------------------------------------------------
View invalidate-yubi
if [[ -z "$1" ]]; then
echo "usage: $0 <key>"
exit 1
curl -X POST -d "key=$1"
View vimeo-speedup.html
<a href="javascript:(function(v){if (v) {var r = prompt('Playback rate?');var f = parseFloat(r);v.playbackRate = f;}})(document.querySelector('video'))">Video Speedup</a>
You can’t perform that action at this time.