Skip to content

Instantly share code, notes, and snippets.

View mndrix's full-sized avatar

Michael Hendricks mndrix

View GitHub Profile
@mndrix
mndrix / lexer.mli
Created July 30, 2023 17:07
Lexical analysis with OCaml effect handlers
type t = Lexing.lexbuf -> Parser.token
val of_file : string -> t * Lexing.lexbuf
(** [of_file path] returns a new lexer for extracting tokens from
a file at [path]. *)
@mndrix
mndrix / build-gnatcoll-bindings
Last active November 13, 2021 17:48
Scripts for building GNAT, et al on OpenBSD
#/bin/sh
#
# Build gnatcoll-bindings from source.
#
# Make sure that the first element of PATH is /usr/local and the
# second element is the GNAT toolchain you want to use.
set -e
usage() {
echo "usage: build-gnatcoll-bindings gnatcoll-bindings-src"
@mndrix
mndrix / sms.go
Last active June 23, 2020 17:20
SMS over IRC
// A proxy for sending/receiving SMS via IRC
//
// This code is part of our family IRC server whose code is available at
// https://gist.github.com/mndrix/7947009178e4a18c247b4bd25821661f
//
// This file won't compile by itself because it's only one file from
// my larger family server (movie hosting, Asterisk dialplan, Git
// hosting, personal assistant, etc).
//
// Copyright 2018 Michael Hendricks
@mndrix
mndrix / irc.go
Last active June 23, 2020 17:21
Family IRC server
// My small, family IRC server
//
// This file won't compile by itself because it's only one file from
// my larger family server (movie hosting, Asterisk dialplan, Git
// hosting, personal assistant, etc).
//
// Users authenticate via NICK and PASS. The USER is interpreted as a
// "device" name. That allows each user to connect from multiple
// devices simultaneously while still appearing as only one nick in
// channels. Each nick-device combo has a queue of messages which
@mndrix
mndrix / read-race.go
Created March 3, 2017 14:07
Can multiple goroutines read from a single map?
package main
// "go run -race read-race.go"
import (
"fmt"
"sync"
)
func main() {
@mndrix
mndrix / sample.txt
Created January 6, 2017 21:20
SWI-Prolog V7.3.34 pack_install sample
Sampling process 43655 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling swipl (pid 43655) every 1 millisecond
Process: swipl [43655]
Path: /Users/michael/lib/swipl-7.3.34/bin/x86_64-darwin15.6.0/swipl
Load Address: 0x101c2e000
Identifier: swipl
Version: 0
Code Type: X86-64
Parent Process: bash [41679]
@mndrix
mndrix / tmux.conf
Created December 20, 2016 17:52
tmux config for my workspace
# main: window where I spend most of my time
tmux rename-window main
# shells: window where spare shells live (see C-n and C-p)
new-window -d
rename-window -t 2 shells
split-window -d -t shells
split-window -d -t shells
@mndrix
mndrix / collatz.eve
Created December 9, 2016 12:56
Collatz Conjecture in Eve
# Collatz Conjecture
## Description
The Collatz Conjecture deals with an integer #`n` and the #`steps` it takes to reach 1.
```
commit
[#n]
[#step]
```
@mndrix
mndrix / hello.ama
Last active October 31, 2016 18:25
Hello Amalog
use("amalog.org/std/io", Io); # See Note_use
main(W) {
Io.printf(W, "Hello, world!\n");
}
### Note_use:
`use/2` is a macro that expands into
@mndrix
mndrix / README.md
Last active October 28, 2016 18:59
Abandoned attempt at a nice Go package for PayPal's NVP API. That API is too much of an abomination to proceed