Skip to content

Instantly share code, notes, and snippets.


Ben Hamill benhamill

View GitHub Profile
benhamill /
Last active May 22, 2020
My take on Kobolds: Nature's dog/bird/lizard friends.



I have never, I'm pretty sure, read any official write-up of what a kobold is. Everything I know about kobolds is apocryphal and from various conflicting sources. That is, as far as I'm concerned, as it should be. I don't put much stock in official sources, anyway, because they mostly talk about how kobolds are inherently evil, which is garbage.

View bash_shell.txt
Last login: Thu Feb 25 00:02:32 on ttys004
UALC02NJ0RCG3QR:~ bhamill$ bash --version
GNU bash, version 4.3.42(1)-release (x86_64-apple-darwin14.5.0)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
UALC02NJ0RCG3QR:~ bhamill$ cat ~/.bashrc
export HI=hi
View input_test.exs
#!/usr/bin/env elixir
defmodule Listen do
use GenServer
## Client
def start_link(command, opts \\ []) do
GenServer.start_link(__MODULE__, command, opts)
benhamill /
Last active Feb 15, 2016
Elixir Port Experiment

I'm trying to understand how Elixir's Port works. I'd like to interact with another command that's run and communicate over :stdio and detect when the other proccess ends in order to gracefully handle it. In my actual application, I'll send input to the other process, get the result and check it. If it's good, I'll repeat. However, if the other process exits after sending any result, my program should take some actions and then exit its self. This is meant to be normal behavior, not an error.

However, when I run the below toy script, I'm getting errors trying to deal with the other process exiting. The 3 other processes I wrote are meant to read one line, echo it back, then exit, while the toy script has 3 items to deal with (it should just do the first, then report exit and end).

Here's how it's running on my system:

View actual
1) test monitors existing entries (KV.RegistryTest)
No message matching {:exit, "shopping", ^bucket} after 100ms. Process mailbox:
{:create, "shopping", #PID<0.151.0>}
benhamill / stub_service.rb
Created Nov 2, 2013
Just testing out ideas from this blog post:
View stub_service.rb
require 'webmock'
require 'sinatra/base'
require 'multi_json'
require 'pry'
require 'faraday'
class HalSinatra < Sinatra::Base
configure do
View inflector_issue.rb
gem 'activesupport', '4.0.0'
require 'minitest/autorun'
require 'active_support/inflector'
class BugTest < MiniTest::Unit::TestCase
def test_underscore_knows_about_acronyms_in_directories
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym 'OAuth'
benhamill / wut.rb
Created Aug 6, 2013
includes + where + select Ignores Your select_values See [this repo]( for an interactive explanation, which might aid investigation.
View wut.rb
gem 'activerecord', '4.0.0'
require 'active_record'
require 'sqlite3'
require 'logger'
require 'minitest/autorun'
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger =
View 1_before.rb
def example_method
[1,2].map do |i|
puts i
puts 'whoa'
View named_params.rb
def new(first_name: 'Ben',
last_name: 'Hamill',
birthday: '1982/02/13',
title: 'Software Engineer')
@name = "#{first_name} #{last_name}"
@birthday = Date.parse(birthday)
@title = title
def new(