Skip to content

Instantly share code, notes, and snippets.

View jemc's full-sized avatar
🔍
Open to new work opportunities

Joe Eli McIlvain jemc

🔍
Open to new work opportunities
  • Movable Ink
  • Cascadia
View GitHub Profile
set -ex
# This script sets up a fresh Raspberry Pi 2 with Raspbian for the purposes
# of driving a string of color-changing LEDs to act as Christmas lights.
# I've written this out because it's common for the flash to get corrupted
# and have to start over fresh from recovery mode.
sudo apt-get remove wolfram-engine # way too huge and unnecessary
sudo apt-get update
sudo dnf install -y boost-devel glibmm24-devel libsndfile-devel libarchive-devel liblo-devel taglib-devel vamp-plugin-sdk-devel rubberband-devel fftw-devel aubio-devel pangomm-devel liblrdf-devel libsamplerate-devel lv2-devel serd-devel sord-devel sratom-devel lilv-devel gtkmm24-devel
let alloc_fn = @{(size: USize): Pointer[U8] =>
@pony_alloc[Pointer[U8]](@pony_ctx[Pointer[None] iso](), size)
}
let realloc_fn = @{(p: Pointer[U8], oldsz: USize, sz: USize): Pointer[U8] =>
@pony_realloc[Pointer[U8]](@pony_ctx[Pointer[None] iso](), p, sz)
}
let free_fn = @{(p: Pointer[U8], size: USize) =>
#!/usr/bin/bash
##
# In Pony 0.16.0, we introduced a breaking syntax change that affects all calls
# to partial functions (functions that can raise an error).
#
# All partial function calls are now required to be followed by a question mark.
#
# For example, `iterator.next()` is now `iterator.next()?`, providing a visual
# indication at the call site of any places where an error may be raised.
@jemc
jemc / unreachable.pony
Created February 13, 2017 19:57
A pattern for dealing with unreachable conditions in Pony.
class Unreachable
new create(value: (Stringable | None) = None, loc: SourceLoc = __loc) =>
@printf[I32](
"ABORT: Unreachable condition at %s:%zu (in %s method)\n".cstring(),
loc.file().cstring(), loc.line(), loc.method().cstring())
if value isnt None then
@printf[I32]("%s\n".cstring(), value.string().cstring())
end
@jemc
jemc / inbox.pony
Last active September 10, 2016 05:33
use "collections"
use "debug"
interface tag InboxTarget[M: Any val]
be process(m: M)
actor Inbox[M: Any val]
"""
An inbox that holds the latest posted message of type M,
forwarding the message to the current target if and when the target is ready.

Keybase proof

I hereby claim:

  • I am jemc on github.
  • I am jemc (https://keybase.io/jemc) on keybase.
  • I have a public key whose fingerprint is 8538 31C7 196B A075 1208 3EE4 9C0F CEC6 60C9 F1E8

To claim this, I am signing this object:

# List all mnesia tables used in the server.
rabbitmqctl eval 'mnesia:system_info(tables).'
# => [rabbit_exchange_type_consistent_hash,mirrored_sup_childspec,gm_group,
# rabbit_queue,rabbit_durable_queue,rabbit_runtime_parameters,
# rabbit_exchange_serial,rabbit_exchange,rabbit_durable_exchange,
# rabbit_topic_trie_binding,rabbit_topic_trie_edge,rabbit_topic_trie_node,
# rabbit_reverse_route,rabbit_route,rabbit_semi_durable_route,
# rabbit_durable_route,rabbit_listener,rabbit_vhost,rabbit_user_permission,
# rabbit_user,schema]
@jemc
jemc / oa.pony
Created May 18, 2016 21:22 — forked from SeanTAllen/oa.pony
Pony Solution to the Expression Problem Using Object Algebras see http://i.cs.hku.hk/~bruno/oa/ for more info
interface ExpAlg[E]
fun lit(x: I32): E
fun add(e1: E, e2: E): E
interface Eval
fun eval(): I32
interface EvalExpAlg
fun lit(x: I32): Eval val =>
recover
@jemc
jemc / pipe.pony
Created March 18, 2016 20:11
Pony example of just piping stdin to stdout.
actor Main
let env: Env
new create(env': Env) =>
env = env'
env.input(notify())
be print(data: ByteSeq val) =>
env.out.print(data)
fun tag notify(): StdinNotify iso^ =>